From 7e45e7a9ab38ee904ca62ed9934e933fdb1d6e9c Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 4 Dec 2020 18:54:47 -0800 Subject: x86-64: Convert load to mov only for GOTPCRELX relocations Since converting load to mov needs to rewrite the REX byte and we don't know if there is a REX byte with GOTPCREL relocation, do it only for GOTPCRELX relocations. bfd/ PR ld/27016 * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Convert load to mov only for GOTPCRELX relocations. ld/ PR ld/27016 * testsuite/ld-x86-64/x86-64.exp: Run pr27016a and pr27016b. * testsuite/ld-x86-64/pr27016a.d: New file. * testsuite/ld-x86-64/pr27016a.s: Likewise. * testsuite/ld-x86-64/pr27016b.d: Likewise. * testsuite/ld-x86-64/pr27016b.s: Likewise. --- bfd/ChangeLog | 6 ++++++ bfd/elf64-x86-64.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fa29df2..2d1e4da 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-12-04 H.J. Lu + + PR ld/27016 + * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Convert load + to mov only for GOTPCRELX relocations. + 2020-12-04 Alan Modra PR 26978 diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 549a8be..bb33967 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -1731,7 +1731,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd, if (opcode == 0x8b) { - if (abs_symbol && local_ref) + if (abs_symbol && local_ref && relocx) to_reloc_pc32 = FALSE; if (to_reloc_pc32) -- cgit v1.1