+2005-06-03 Alan Modra <amodra@bigpond.net.au>
+
+ * elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
+ for all reloc types.
+
2005-06-02 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (add_symbol_adjust): Set sym visibility to most
asection *srelplt;
asection *sdynbss;
asection *srelbss;
-
+
/* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
asection *srelplt2;
/* Value used to fill the last word of the first plt entry. */
bfd_byte plt0_pad_byte;
-
+
union {
bfd_signed_vma refcount;
bfd_vma offset;
unresolved_reloc, warned);
}
+ if (r_symndx == 0)
+ {
+ /* 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 in the switch below. */
+ r_type = R_386_NONE;
+
+ relocation = 0;
+ if (howto->pc_relative)
+ relocation = (input_section->output_section->vma
+ + input_section->output_offset
+ + rel->r_offset);
+ }
+
switch (r_type)
{
case R_386_GOT32:
case R_386_32:
case R_386_PC32:
- /* r_symndx will be zero only for relocs against symbols
- from removed linkonce sections, or sections discarded by
- a linker script. */
- if (r_symndx == 0)
- {
- /* Zero the section contents. eh_frame generated by old
- versions of gcc isn't edited by elf-eh-frame.c, so
- FDEs for discarded linkonce functions might remain.
- Putting zeros here will zero such FDE's address range.
- This is a hint to unwinders and other consumers of
- exception handling info that the FDE is invalid. */
- bfd_put_32 (input_bfd, 0, contents + rel->r_offset);
- break;
- }
-
if ((input_section->flags & SEC_ALLOC) == 0)
break;
bfd_elf32_swap_reloc_out (output_bfd, &rel,
loc + sizeof (Elf32_External_Rel));
}
-
}
else
{