Check if symbol is defined when converting mov to lea
We need to check if symbol is defined when converting mov to lea since SYMBOL_REFERENCES_LOCAL may return true on hidden undefined symbols. * elf32-i386.c (elf_i386_convert_mov_to_lea): Check if symbol is defined. * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
This commit is contained in:
parent
b31bcacc48
commit
75a06c790f
3 changed files with 12 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2015-10-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* elf32-i386.c (elf_i386_convert_mov_to_lea): Check if symbol
|
||||
is defined.
|
||||
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
|
||||
|
||||
2015-10-16 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* elf32-i386.c (elf_i386_convert_mov_to_lea): Don't check
|
||||
|
|
|
@ -2815,7 +2815,9 @@ elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
|
|||
|
||||
/* STT_GNU_IFUNC must keep R_386_GOT32 relocation. We also avoid
|
||||
optimizing _DYNAMIC since ld.so may use its link-time address. */
|
||||
if (h->type != STT_GNU_IFUNC
|
||||
if ((h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& h->type != STT_GNU_IFUNC
|
||||
&& h != htab->elf.hdynamic
|
||||
&& SYMBOL_REFERENCES_LOCAL (link_info, h)
|
||||
&& irel->r_offset >= 2
|
||||
|
|
|
@ -3074,7 +3074,9 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
|
|||
/* STT_GNU_IFUNC must keep R_X86_64_GOTPCREL relocation. We also
|
||||
avoid optimizing _DYNAMIC since ld.so may use its link-time
|
||||
address. */
|
||||
if (h->type != STT_GNU_IFUNC
|
||||
if ((h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& h->type != STT_GNU_IFUNC
|
||||
&& h != htab->elf.hdynamic
|
||||
&& SYMBOL_REFERENCES_LOCAL (link_info, h))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue