diff options
author | Alan Modra <amodra@bigpond.net.au> | 2005-06-03 04:00:18 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2005-06-03 04:00:18 +0000 |
commit | 56f8a310d8a139944242373690497d0bd9b9696e (patch) | |
tree | 98caddfa15e78a6dae41194d6e4013579e24cf4a | |
parent | 1b1c16fbb6e6f6afd6e8520a977a967e014fad8e (diff) | |
download | gdb-56f8a310d8a139944242373690497d0bd9b9696e.tar.gz |
PR 568
* elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
for all reloc types.
Apply from mainline:
2005-05-12 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (elf_i386_relocate_section): Allow R_386_GOTOFF
against protected function when building executable.
-rw-r--r-- | bfd/ChangeLog | 13 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 31 |
2 files changed, 28 insertions, 16 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bd81db1f8a5..24b318f65d5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,4 +1,15 @@ -2005-06-02 Alan Modra <amodra@bigpond.net.au> +2005-06-03 Alan Modra <amodra@bigpond.net.au> + + PR 568 + * elf32-i386.c (elf_i386_relocate_section): Handle zero symndx + for all reloc types. + + Apply from mainline: + 2005-05-12 H.J. Lu <hongjiu.lu@intel.com> + * elf32-i386.c (elf_i386_relocate_section): Allow R_386_GOTOFF + against protected function when building executable. + +2005-06-03 Alan Modra <amodra@bigpond.net.au> * elf64-ppc.c (add_symbol_adjust): Set sym visibility to most restrictive of func code and func descr for undefined syms as well 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; |