aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf32-i386.c35
2 files changed, 22 insertions, 18 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a37d99c..b647b27 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 3e5f339..30270d3 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -602,7 +602,7 @@ struct elf_i386_link_hash_table
asection *srelplt;
asection *sdynbss;
asection *srelbss;
-
+
/* The (unloaded but important) .rel.plt.unloaded section on VxWorks. */
asection *srelplt2;
@@ -614,7 +614,7 @@ struct elf_i386_link_hash_table
/* 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;
@@ -2270,6 +2270,21 @@ elf_i386_relocate_section (bfd *output_bfd,
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:
@@ -2426,21 +2441,6 @@ elf_i386_relocate_section (bfd *output_bfd,
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;
@@ -3159,7 +3159,6 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
bfd_elf32_swap_reloc_out (output_bfd, &rel,
loc + sizeof (Elf32_External_Rel));
}
-
}
else
{