diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-10-16 04:17:49 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-10-16 04:21:03 -0700 |
commit | 75a06c790f96f07e859be95d3c3c084a718afeef (patch) | |
tree | 0bfcfdf1a076b872319aa77ccd463188a206b0a9 /bfd/elf64-x86-64.c | |
parent | b31bcacc489d6ede2e9bdfa9905de0ebfd919454 (diff) | |
download | binutils-75a06c790f96f07e859be95d3c3c084a718afeef.zip binutils-75a06c790f96f07e859be95d3c3c084a718afeef.tar.gz binutils-75a06c790f96f07e859be95d3c3c084a718afeef.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index aad3244..dc5fd0d 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -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)) { |