This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/3958: ELF linker failed to handle relocation against STN_UNDEF


On Mon, Mar 05, 2007 at 07:28:49PM -0500, Daniel Jacobowitz wrote:
> On Tue, Mar 06, 2007 at 10:22:39AM +1030, Alan Modra wrote:
> > On Sat, Mar 03, 2007 at 03:04:22PM -0800, H. J. Lu wrote:
> > > But we shouldn't use STN_UNDEF to indicate relocations
> > > against symbols from removed input sections since STN_UNDEF simply
> > > means 0 as the symbol value for relocation.
> > 
> > Agreed.  We should instead either relocate against the corresponding
> > symbol from the kept section and emit a reloc against that symbol, or
> > zero the section contents and emit an R_*_NONE reloc.  The difficulty
> > is that this means touching all the ELF backend relocate_section
> > functions, because we need the reloc howto function to know which bits
> > need zeroing.  Also, the section contents will need to be cleared on
> > a relocatable link.
> 
> This should happen in more or less the same places my previous broken
> patch touched all the backends, though - shouldn't it?

Well, this is what I have for x86, ppc and m32r.  More to come..
The basic approach in the backends is to move ld -r processing after
we set up sym, sec, h etc. needed for a final link.  Then there is
just one place in the backend to handle relocs against syms in
discarded sections.  The x86 patch below also merges relocatable
link handling of section syms with code for SEC_MERGE section syms.

Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.252
diff -u -p -r1.252 elflink.c
--- bfd/elflink.c	22 Feb 2007 17:03:59 -0000	1.252
+++ bfd/elflink.c	6 Mar 2007 02:15:21 -0000
@@ -8394,16 +8394,6 @@ elf_link_input_bfd (struct elf_final_lin
 			      continue;
 			    }
 			}
-
-		      /* Remove the symbol reference from the reloc, but
-			 don't kill the reloc completely.  This is so that
-			 a zero value will be written into the section,
-			 which may have non-zero contents put there by the
-			 assembler.  Zero in things like an eh_frame fde
-			 pc_begin allows stack unwinders to recognize the
-			 fde as bogus.  */
-		      rel->r_info &= r_type_mask;
-		      rel->r_addend = 0;
 		    }
 		}
 	    }
@@ -8467,6 +8457,7 @@ elf_link_input_bfd (struct elf_final_lin
 		  unsigned long r_symndx;
 		  asection *sec;
 		  Elf_Internal_Sym sym;
+		  struct elf_link_hash_entry *rh;
 
 		  if (next_erel == bed->s->int_rels_per_ext_rel)
 		    {
@@ -8506,7 +8497,6 @@ elf_link_input_bfd (struct elf_final_lin
 		      || (elf_bad_symtab (input_bfd)
 			  && finfo->sections[r_symndx] == NULL))
 		    {
-		      struct elf_link_hash_entry *rh;
 		      unsigned long indx;
 
 		      /* This is a reloc against a global symbol.  We
@@ -8522,22 +8512,38 @@ elf_link_input_bfd (struct elf_final_lin
 			     || rh->root.type == bfd_link_hash_warning)
 			rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
 
-		      /* Setting the index to -2 tells
-			 elf_link_output_extsym that this symbol is
-			 used by a reloc.  */
+		      sec = NULL;
+		      if (rh->root.type == bfd_link_hash_defined
+			  || rh->root.type == bfd_link_hash_defweak)
+			sec = rh->root.u.def.section;
+		    }
+		  else
+		    {
+		      /* This is a reloc against a local symbol.  */
+		      sym = isymbuf[r_symndx];
+		      sec = finfo->sections[r_symndx];
+		      rh = NULL;
+		    }
+
+		  if (sec != NULL && elf_discarded_section (sec))
+		    {
+		      /* This is a reloc against a symbol in a discarded
+			 section.  Turn it into an R_*_NONE reloc.  */
+		      irela->r_info = 0;
+		      irela->r_addend = 0;
+		      continue;
+		    }
+
+		  if (rh != NULL)
+		    {
+		      /* Setting the index to -2 tells elf_link_output_extsym
+			 that this global symbol is used by a reloc.  */
 		      BFD_ASSERT (rh->indx < 0);
 		      rh->indx = -2;
-
 		      *rel_hash = rh;
-
 		      continue;
 		    }
 
-		  /* This is a reloc against a local symbol.  */
-
-		  *rel_hash = NULL;
-		  sym = isymbuf[r_symndx];
-		  sec = finfo->sections[r_symndx];
 		  if (ELF_ST_TYPE (sym.st_info) == STT_SECTION)
 		    {
 		      /* I suppose the backend ought to fill in the
@@ -8555,18 +8561,6 @@ elf_link_input_bfd (struct elf_final_lin
 			{
 			  asection *osec = sec->output_section;
 
-			  /* If we have discarded a section, the output
-			     section will be the absolute section.  In
-			     case of discarded link-once and discarded
-			     SEC_MERGE sections, use the kept section.  */
-			  if (bfd_is_abs_section (osec)
-			      && sec->kept_section != NULL
-			      && sec->kept_section->output_section != NULL)
-			    {
-			      osec = sec->kept_section->output_section;
-			      irela->r_addend -= osec->vma;
-			    }
-
 			  if (!bfd_is_abs_section (osec))
 			    {
 			      r_symndx = osec->target_index;
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.168
diff -u -p -r1.168 elf32-i386.c
--- bfd/elf32-i386.c	3 Nov 2006 00:58:09 -0000	1.168
+++ bfd/elf32-i386.c	6 Mar 2007 02:15:23 -0000
@@ -1,6 +1,6 @@
 /* Intel 80386/80486-specific support for 32-bit ELF
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -2264,51 +2264,6 @@ elf_i386_relocate_section (bfd *output_b
       howto = elf_howto_table + indx;
 
       r_symndx = ELF32_R_SYM (rel->r_info);
-
-      if (info->relocatable)
-	{
-	  bfd_vma val;
-	  bfd_byte *where;
-
-	  /* This is a relocatable link.  We don't have to change
-	     anything, unless the reloc is against a section symbol,
-	     in which case we have to adjust according to where the
-	     section symbol winds up in the output section.  */
-	  if (r_symndx >= symtab_hdr->sh_info)
-	    continue;
-
-	  sym = local_syms + r_symndx;
-	  if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
-	    continue;
-
-	  sec = local_sections[r_symndx];
-	  val = sec->output_offset;
-	  if (val == 0)
-	    continue;
-
-	  where = contents + rel->r_offset;
-	  switch (howto->size)
-	    {
-	      /* FIXME: overflow checks.  */
-	    case 0:
-	      val += bfd_get_8 (input_bfd, where);
-	      bfd_put_8 (input_bfd, val, where);
-	      break;
-	    case 1:
-	      val += bfd_get_16 (input_bfd, where);
-	      bfd_put_16 (input_bfd, val, where);
-	      break;
-	    case 2:
-	      val += bfd_get_32 (input_bfd, where);
-	      bfd_put_32 (input_bfd, val, where);
-	      break;
-	    default:
-	      abort ();
-	    }
-	  continue;
-	}
-
-      /* This is a final link.  */
       h = NULL;
       sym = NULL;
       sec = NULL;
@@ -2320,10 +2275,12 @@ elf_i386_relocate_section (bfd *output_b
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
-	  if ((sec->flags & SEC_MERGE)
-	      && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+
+	  if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
+	      && ((sec->flags & SEC_MERGE) != 0
+		  || (info->relocatable
+		      && sec->output_offset != 0)))
 	    {
-	      asection *msec;
 	      bfd_vma addend;
 	      bfd_byte *where = contents + rel->r_offset;
 
@@ -2357,10 +2314,16 @@ elf_i386_relocate_section (bfd *output_b
 		  abort ();
 		}
 
-	      msec = sec;
-	      addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec, addend);
-	      addend -= relocation;
-	      addend += msec->output_section->vma + msec->output_offset;
+	      if (info->relocatable)
+		addend += sec->output_offset;
+	      else
+		{
+		  asection *msec = sec;
+		  addend = _bfd_elf_rel_local_sym (output_bfd, sym, &msec,
+						   addend);
+		  addend -= relocation;
+		  addend += msec->output_section->vma + msec->output_offset;
+		}
 
 	      switch (howto->size)
 		{
@@ -2393,16 +2356,18 @@ elf_i386_relocate_section (bfd *output_b
 				   unresolved_reloc, warned);
 	}
 
-      if (r_symndx == 0)
+      if (sec != NULL && elf_discarded_section (sec))
 	{
-	  /* r_symndx will be zero only for relocs against symbols from
-	     removed linkonce sections, or sections discarded by a linker
-	     script.  For these relocs, we just want the section contents
-	     zeroed.  Avoid any special processing.  */
+	  /* For relocs against symbols from removed linkonce sections,
+	     or sections discarded by a linker script, we just want the
+	     section contents zeroed.  Avoid any special processing.  */
 	  _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
 	  continue;
 	}
 
+      if (info->relocatable)
+	continue;
+
       switch (r_type)
 	{
 	case R_386_GOT32:
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.209
diff -u -p -r1.209 elf32-ppc.c
--- bfd/elf32-ppc.c	1 Feb 2007 05:35:58 -0000	1.209
+++ bfd/elf32-ppc.c	6 Mar 2007 02:15:27 -0000
@@ -1,6 +1,6 @@
 /* PowerPC-specific support for 32-bit ELF
    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005, 2006 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -5564,29 +5564,6 @@ ppc_elf_relocate_section (bfd *output_bf
 
   got2 = bfd_get_section_by_name (input_bfd, ".got2");
 
-  if (info->relocatable)
-    {
-      if (got2 == NULL)
-	return TRUE;
-
-      rel = relocs;
-      relend = relocs + input_section->reloc_count;
-      for (; rel < relend; rel++)
-	{
-	  enum elf_ppc_reloc_type r_type;
-
-	  r_type = ELF32_R_TYPE (rel->r_info);
-	  if (r_type == R_PPC_PLTREL24
-	      && rel->r_addend >= 32768)
-	    {
-	      /* R_PPC_PLTREL24 is rather special.  If non-zero, the
-		 addend specifies the GOT pointer offset within .got2.  */
-	      rel->r_addend += got2->output_offset;
-	    }
-	}
-      return TRUE;
-    }
-
   /* Initialize howto table if not already done.  */
   if (!ppc_elf_howto_table[R_PPC_ADDR32])
     ppc_elf_howto_init ();
@@ -5640,6 +5617,31 @@ ppc_elf_relocate_section (bfd *output_bf
 	  sym_name = h->root.root.string;
 	}
 
+      if (sec != NULL && elf_discarded_section (sec))
+	{
+	  /* For relocs against symbols from removed linkonce sections,
+	     or sections discarded by a linker script, we just want the
+	     section contents zeroed.  Avoid any special processing.  */
+	  howto = NULL;
+	  if (r_type < R_PPC_max)
+	    howto = ppc_elf_howto_table[r_type];
+	  _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+	  continue;
+	}
+
+      if (info->relocatable)
+	{
+	  if (got2 != NULL
+	      && r_type == R_PPC_PLTREL24
+	      && rel->r_addend >= 32768)
+	    {
+	      /* R_PPC_PLTREL24 is rather special.  If non-zero, the
+		 addend specifies the GOT pointer offset within .got2.  */
+	      rel->r_addend += got2->output_offset;
+	    }
+	  continue;
+	}
+
       /* TLS optimizations.  Replace instruction sequences and relocs
 	 based on information we collected in tls_optimize.  We edit
 	 RELOCS so that --emit-relocs will output something sensible
@@ -6225,17 +6227,7 @@ ppc_elf_relocate_section (bfd *output_bf
 	case R_PPC_ADDR14_BRNTAKEN:
 	case R_PPC_UADDR32:
 	case R_PPC_UADDR16:
-	  /* r_symndx will be zero only for relocs against symbols
-	     from removed linkonce sections, or sections discarded by
-	     a linker script.  */
 	dodyn:
-	  if (r_symndx == 0)
-	    {
-	      _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
-	      break;
-	    }
-	  /* Fall thru.  */
-
 	  if ((input_section->flags & SEC_ALLOC) == 0)
 	    break;
 	  /* Fall thru.  */
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.83
diff -u -p -r1.83 elf32-m32r.c
--- bfd/elf32-m32r.c	17 Oct 2006 13:41:46 -0000	1.83
+++ bfd/elf32-m32r.c	6 Mar 2007 02:30:30 -0000
@@ -1,6 +1,6 @@
 /* M32R-specific support for 32-bit ELF.
    Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-   2006 Free Software Foundation, Inc.
+   2006, 2007 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -2477,6 +2477,7 @@ m32r_elf_relocate_section (bfd *output_b
          `r_addend'.  */
       bfd_vma addend = rel->r_addend;
       bfd_vma offset = rel->r_offset;
+      bfd_vma relocation;
       Elf_Internal_Sym *sym;
       asection *sec;
       const char *sym_name;
@@ -2509,27 +2510,150 @@ m32r_elf_relocate_section (bfd *output_b
       howto = m32r_elf_howto_table + r_type;
       r_symndx = ELF32_R_SYM (rel->r_info);
 
-      if (info->relocatable && use_rel)
+      sym = NULL;
+      sec = NULL;
+      h = NULL;
+
+      if (r_symndx < symtab_hdr->sh_info)
+	{
+	  /* Local symbol.  */
+	  sym = local_syms + r_symndx;
+	  sec = local_sections[r_symndx];
+	  sym_name = "<local symbol>";
+
+	  if (!use_rel)
+	    {
+	      relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
+	      addend = rel->r_addend;
+	    }
+	  else
+	    {
+	      relocation = (sec->output_section->vma
+			    + sec->output_offset
+			    + sym->st_value);
+	    }
+	}
+      else
+	{
+	  /* External symbol.  */
+	  relocation = 0;
+
+	  h = sym_hashes[r_symndx - symtab_hdr->sh_info];
+	  while (h->root.type == bfd_link_hash_indirect
+		 || h->root.type == bfd_link_hash_warning)
+	    h = (struct elf_link_hash_entry *) h->root.u.i.link;
+	  sym_name = h->root.root.string;
+
+	  if (h->root.type == bfd_link_hash_defined
+	      || h->root.type == bfd_link_hash_defweak)
+	    {
+	      bfd_boolean dyn;
+	      sec = h->root.u.def.section;
+
+	      dyn = htab->root.dynamic_sections_created;
+	      sec = h->root.u.def.section;
+	      if (r_type == R_M32R_GOTPC24
+		  || (r_type == R_M32R_GOTPC_HI_ULO
+		      || r_type == R_M32R_GOTPC_HI_SLO
+		      || r_type == R_M32R_GOTPC_LO)
+		  || (r_type == R_M32R_26_PLTREL
+		      && h->plt.offset != (bfd_vma) -1)
+		  || ((r_type == R_M32R_GOT24
+		       || r_type == R_M32R_GOT16_HI_ULO
+		       || r_type == R_M32R_GOT16_HI_SLO
+		       || r_type == R_M32R_GOT16_LO)
+		      && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
+							  info->shared, h)
+		      && (! info->shared
+			  || (! info->symbolic && h->dynindx != -1)
+			  || !h->def_regular))
+		  || (info->shared
+		      && ((! info->symbolic && h->dynindx != -1)
+			  || !h->def_regular)
+		      && (((r_type == R_M32R_16_RELA
+			    || r_type == R_M32R_32_RELA
+			    || r_type == R_M32R_24_RELA
+			    || r_type == R_M32R_HI16_ULO_RELA
+			    || r_type == R_M32R_HI16_SLO_RELA
+			    || r_type == R_M32R_LO16_RELA)
+			   && !h->forced_local)
+			  || r_type == R_M32R_REL32
+			  || r_type == R_M32R_10_PCREL_RELA
+			  || r_type == R_M32R_18_PCREL_RELA
+			  || r_type == R_M32R_26_PCREL_RELA)
+		      && ((input_section->flags & SEC_ALLOC) != 0
+			  /* DWARF will emit R_M32R_16(24,32) relocations
+			     in its sections against symbols defined
+			     externally in shared libraries.  We can't do
+			     anything with them here.  */
+			  || ((input_section->flags & SEC_DEBUGGING) != 0
+			      && h->def_dynamic))))
+		{
+		  /* In these cases, we don't need the relocation
+		     value.  We check specially because in some
+		     obscure cases sec->output_section will be NULL.  */
+		}
+	      else if (sec->output_section != NULL)
+		relocation = (h->root.u.def.value
+			      + sec->output_section->vma
+			      + sec->output_offset);
+	      else if (!info->relocatable)
+		{
+		  (*_bfd_error_handler)
+		    (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+		     input_bfd,
+		     input_section,
+		     (long) rel->r_offset,
+		     howto->name,
+		     h->root.root.string);
+		}
+	    }
+	  else if (h->root.type == bfd_link_hash_undefweak)
+	    ;
+	  else if (info->unresolved_syms_in_objects == RM_IGNORE
+		   && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
+	    ;
+	  else if (!info->relocatable)
+	    {
+	      if (! ((*info->callbacks->undefined_symbol)
+		     (info, h->root.root.string, input_bfd,
+		      input_section, offset,
+		      (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
+		       || ELF_ST_VISIBILITY (h->other)))))
+		return FALSE;
+	    }
+	}
+
+      if (sec != NULL && elf_discarded_section (sec))
+	{
+	  /* For relocs against symbols from removed linkonce sections,
+	     or sections discarded by a linker script, we just want the
+	     section contents zeroed.  Avoid any special processing.  */
+	  _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset);
+	  continue;
+	}
+
+      if (info->relocatable && !use_rel)
 	{
 	  /* This is a relocatable link.  We don't have to change
 	     anything, unless the reloc is against a section symbol,
 	     in which case we have to adjust according to where the
 	     section symbol winds up in the output section.  */
-	  sec = NULL;
-	  if (r_symndx >= symtab_hdr->sh_info)
-	    /* External symbol.  */
-	    continue;
+	  if (sym != NULL && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+	    rel->r_addend += sec->output_offset;
+	  continue;
+	}
 
-	  /* Local symbol.  */
-	  sym = local_syms + r_symndx;
-	  sym_name = "<local symbol>";
-	  /* STT_SECTION: symbol is associated with a section.  */
-	  if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
-	    /* Symbol isn't associated with a section.  Nothing to do.  */
+      if (info->relocatable && use_rel)
+	{
+	  /* This is a relocatable link.  We don't have to change
+	     anything, unless the reloc is against a section symbol,
+	     in which case we have to adjust according to where the
+	     section symbol winds up in the output section.  */
+	  if (sym == NULL || ELF_ST_TYPE (sym->st_info) != STT_SECTION)
 	    continue;
 
-	  sec = local_sections[r_symndx];
-	  addend += sec->output_offset + sym->st_value;
+	  addend += sec->output_offset;
 
 	  /* If partial_inplace, we need to store any additional addend
 	     back in the section.  */
@@ -2567,140 +2691,6 @@ m32r_elf_relocate_section (bfd *output_b
 	}
       else
 	{
-	  bfd_vma relocation;
-
-	  /* This is a final link.  */
-	  sym = NULL;
-	  sec = NULL;
-          h = NULL;
-
-	  if (r_symndx < symtab_hdr->sh_info)
-	    {
-	      /* Local symbol.  */
-	      sym = local_syms + r_symndx;
-	      sec = local_sections[r_symndx];
-	      sym_name = "<local symbol>";
-
-              if (!use_rel)
-                {
-	          relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
-	          addend = rel->r_addend;
-
-                  if (info->relocatable)
-                    {
-                      /* This is a relocatable link.  We don't have to change
-                         anything, unless the reloc is against a section symbol,
-                         in which case we have to adjust according to where the
-                         section symbol winds up in the output section.  */
-                      if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
-                        rel->r_addend += sec->output_offset + sym->st_value;
-
-                      continue;
-                    }
-                }
-              else
-                {
-	          relocation = (sec->output_section->vma
-			        + sec->output_offset
-			        + sym->st_value);
-                }
-	    }
-	  else
-	    {
-	      /* External symbol.  */
-              if (info->relocatable && !use_rel)
-                continue;
-
-	      h = sym_hashes[r_symndx - symtab_hdr->sh_info];
-	      while (h->root.type == bfd_link_hash_indirect
-		     || h->root.type == bfd_link_hash_warning)
-		h = (struct elf_link_hash_entry *) h->root.u.i.link;
-	      sym_name = h->root.root.string;
-
-	      if (h->root.type == bfd_link_hash_defined
-		  || h->root.type == bfd_link_hash_defweak)
-		{
-	          bfd_boolean dyn;
-		  sec = h->root.u.def.section;
-
-	          dyn = htab->root.dynamic_sections_created;
-                  sec = h->root.u.def.section;
-                  if (r_type == R_M32R_GOTPC24
-                      || (r_type == R_M32R_GOTPC_HI_ULO
-                          || r_type == R_M32R_GOTPC_HI_SLO
-                          || r_type == R_M32R_GOTPC_LO)
-                      || (r_type == R_M32R_26_PLTREL
-                          && h->plt.offset != (bfd_vma) -1)
-                      || ((r_type == R_M32R_GOT24
-                           || r_type == R_M32R_GOT16_HI_ULO
-                           || r_type == R_M32R_GOT16_HI_SLO
-                           || r_type == R_M32R_GOT16_LO)
-                          && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
-							      info->shared, h)
-                          && (! info->shared
-                              || (! info->symbolic && h->dynindx != -1)
-                              || !h->def_regular))
-                      || (info->shared
-                          && ((! info->symbolic && h->dynindx != -1)
-                              || !h->def_regular)
-                          && (((r_type == R_M32R_16_RELA
-                              || r_type == R_M32R_32_RELA
-                              || r_type == R_M32R_24_RELA
-                              || r_type == R_M32R_HI16_ULO_RELA
-                              || r_type == R_M32R_HI16_SLO_RELA
-                              || r_type == R_M32R_LO16_RELA)
-			          && !h->forced_local)
-                              || r_type == R_M32R_REL32
-                              || r_type == R_M32R_10_PCREL_RELA
-                              || r_type == R_M32R_18_PCREL_RELA
-                              || r_type == R_M32R_26_PCREL_RELA)
-                          && ((input_section->flags & SEC_ALLOC) != 0
-                              /* DWARF will emit R_M32R_16(24,32) relocations
-                                 in its sections against symbols defined
-                                 externally in shared libraries.  We can't do
-                                 anything with them here.  */
-                              || ((input_section->flags & SEC_DEBUGGING) != 0
-                                  && h->def_dynamic))))
-                    {
-                      /* In these cases, we don't need the relocation
-                         value.  We check specially because in some
-                         obscure cases sec->output_section will be NULL.  */
-                      relocation = 0;
-                    }
-		  else if (sec->output_section == NULL)
-                    {
-                      (*_bfd_error_handler)
-                        (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
-			 input_bfd,
-			 input_section,
-			 (long) rel->r_offset,
-			 howto->name,
-			 h->root.root.string);
-
-		       relocation = 0;
-                    }
-		  else
-		    relocation = (h->root.u.def.value
-				  + sec->output_section->vma
-				  + sec->output_offset);
-		}
-	      else if (h->root.type == bfd_link_hash_undefweak)
-		relocation = 0;
-              else if (info->unresolved_syms_in_objects == RM_IGNORE
-                       && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
-                relocation = 0;
-	      else
-		{
-		  if (! ((*info->callbacks->undefined_symbol)
-			 (info, h->root.root.string, input_bfd,
-			  input_section, offset,
-                          (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
-                           || ELF_ST_VISIBILITY (h->other)))))
-		    return FALSE;
-		  relocation = 0;
-		}
-	    }
-
 	  /* Sanity check the address.  */
 	  if (offset > high_address)
 	    {

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]