aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index c9bc694..eab963c 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2631,9 +2631,11 @@ elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec,
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- /* STT_GNU_IFUNC must keep R_386_GOT32 relocation. */
+ /* 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
+ && strcmp (h->root.root.string, "_DYNAMIC") != 0
&& SYMBOL_REFERENCES_LOCAL (link_info, h)
&& bfd_get_8 (input_bfd,
contents + irel->r_offset - 2) == 0x8b)