diff options
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r-- | bfd/elf32-i386.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 9bab9be1244..66b94932774 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2177,6 +2177,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: @@ -2278,6 +2293,7 @@ elf_i386_relocate_section (bfd *output_bfd, for shared library since it may not be local when used as function address. */ if (info->shared + && !info->executable && h && h->def_regular && h->type == STT_FUNC @@ -2332,21 +2348,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; |