diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-10-16 03:14:40 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-10-16 03:14:40 -0700 |
commit | b31bcacc489d6ede2e9bdfa9905de0ebfd919454 (patch) | |
tree | bfc87278ddb921af8d1aa397d8319b61011698db /bfd | |
parent | baf9351a5983e36c9857b6f5b11e991d2bb1e9b6 (diff) | |
download | gdb-b31bcacc489d6ede2e9bdfa9905de0ebfd919454.zip gdb-b31bcacc489d6ede2e9bdfa9905de0ebfd919454.tar.gz gdb-b31bcacc489d6ede2e9bdfa9905de0ebfd919454.tar.bz2 |
Convert mov to lea for loading address of local common symbol
There is no need to check def_regular when converting mov to lea for
loading address of local symbols since def_regular may be false for
common symbols and SYMBOL_REFERENCES_LOCAL is sufficient.
bfd/
* elf32-i386.c (elf_i386_convert_mov_to_lea): Don't check
def_regular.
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
ld/testsuite/
* ld-i386/lea1.s: Add a test for loading address of local common
symbol.
* ld-x86-64/lea1.s: Likewise.
* ld-i386/lea1a.d: Updated.
* ld-i386/lea1b.d: Likewise.
* ld-i386/lea1c.d: Likewise.
* ld-x86-64/lea1a.d: Likewise.
* ld-x86-64/lea1b.d: Likewise.
* ld-x86-64/lea1c.d: Likewise.
* ld-x86-64/lea1d.d: Likewise.
* ld-x86-64/lea1e.d: Likewise.
* ld-x86-64/lea1f.d: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 3 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8400cf6..d26a526 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-10-16 H.J. Lu <hongjiu.lu@intel.com> + + * elf32-i386.c (elf_i386_convert_mov_to_lea): Don't check + def_regular. + * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise. + 2015-10-15 H.J. Lu <hongjiu.lu@intel.com> * elflink.c (_bfd_elf_merge_symbol): Fix typos in comments diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 0a06191..2e5c04d 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2815,8 +2815,7 @@ 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->def_regular - && h->type != STT_GNU_IFUNC + if (h->type != STT_GNU_IFUNC && h != htab->elf.hdynamic && SYMBOL_REFERENCES_LOCAL (link_info, h) && irel->r_offset >= 2 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 29639d8..aad3244 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3074,8 +3074,7 @@ 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->def_regular - && h->type != STT_GNU_IFUNC + if (h->type != STT_GNU_IFUNC && h != htab->elf.hdynamic && SYMBOL_REFERENCES_LOCAL (link_info, h)) { |