binutils-gdb/ld/testsuite/ld-x86-64/pr27016b.d
H.J. Lu 7e45e7a9ab 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.
2020-12-04 18:54:47 -08:00

24 lines
785 B
Makefile

#source: pr27016a.s
#source: pr27016b.s
#as: --64 -mx86-used-note=no -mrelax-relocations=yes
#ld: -m elf_x86_64 -z max-page-size=0x200000 -z noseparate-code -e main
#objdump: -dw
.*: +file format .*
Disassembly of section .text:
0+4000e8 <main>:
+[a-f0-9]+: 55 push %rbp
+[a-f0-9]+: 48 89 e5 mov %rsp,%rbp
+[a-f0-9]+: 49 c7 c3 2c 40 40 00 mov \$0x40402c,%r11
+[a-f0-9]+: 41 8b 03 mov \(%r11\),%eax
+[a-f0-9]+: 8d 50 01 lea 0x1\(%rax\),%edx
+[a-f0-9]+: 49 c7 c3 2c 40 40 00 mov \$0x40402c,%r11
+[a-f0-9]+: 41 89 13 mov %edx,\(%r11\)
+[a-f0-9]+: b8 00 00 00 00 mov \$0x0,%eax
+[a-f0-9]+: 5d pop %rbp
+[a-f0-9]+: c3 ret
#pass