summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-06-03 03:58:13 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-06-03 03:58:13 +0000
commit2a347efd7067018f246d0459e516c9853bff48b8 (patch)
treee136397ab5bdbf232a75543e658e13fef834c3a2 /bfd/elf32-i386.c
parent36be5553fac06952ec788dc60471999c324c8c49 (diff)
downloadgdb-2a347efd7067018f246d0459e516c9853bff48b8.tar.gz
* elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
for all reloc types.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 3e5f33939a4..30270d3003e 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
{