* elf32-i386.c (elf_i386_relocate_section): Handle zero symndx
for all reloc types.
This commit is contained in:
parent
5dc438e501
commit
9635fe2972
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user