aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-06-03 03:58:13 +0000
committerAlan Modra <amodra@gmail.com>2005-06-03 03:58:13 +0000
commit9635fe2972ebb202dfb4f9986d5a5e5ff3fec036 (patch)
tree2c9abaf857636a65339517504b06a6b3ea49d4eb /bfd/elf32-i386.c
parent5dc438e50198a91773db928f1c3642e4d177e3e5 (diff)
downloadgdb-9635fe2972ebb202dfb4f9986d5a5e5ff3fec036.zip
gdb-9635fe2972ebb202dfb4f9986d5a5e5ff3fec036.tar.gz
gdb-9635fe2972ebb202dfb4f9986d5a5e5ff3fec036.tar.bz2
* 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 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
{