binutils-gdb/gold/testsuite/x86_64_mov_to_lea3.s
H.J. Lu 4a54cb0658 gold: Handle R_X86_64_CODE_4_GOTPCRELX
Handle R_X86_64_CODE_4_GOTPCRELX and convert

	mov	name@GOTPCREL(%rip), %r31

to

	lea	name@GOTPCREL(%rip), %r31

if the instruction is encoded with the REX2 prefix when possible.

elfcpp/

	* x86_64.h (R_X86_64_CODE_4_GOTPCRELX): New.

gold/

	* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Handle
	R_X86_64_CODE_4_GOTPCRELX.
	(Target_x86_64::Scan::get_reference_flags): Likewise.
	(Target_x86_64::Scan::local): Likewise.
	(Target_x86_64::Scan::possible_function_pointer_reloc): Likewise.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::Relocate::relocate): Likewise.
	* testsuite/x86_64_mov_to_lea1.s: Add a test for
	R_X86_64_CODE_4_GOTPCRELX.
	* testsuite/x86_64_mov_to_lea2.s: Likewise.
	* testsuite/x86_64_mov_to_lea3.s: Likewise.
	* testsuite/x86_64_mov_to_lea4.s: Likewise.
	* testsuite/x86_64_mov_to_lea5.s: Likewise.
	* testsuite/x86_64_mov_to_lea.sh: Updated.
2023-12-28 08:47:17 -08:00

12 lines
191 B
ArmAsm

.text
.type foo, @function
foo:
ret
.size foo, .-foo
.globl _start
.type _start, @function
_start:
movq foo@GOTPCREL(%rip), %rax
movq foo@GOTPCREL(%rip), %r26
.size _start, .-_start