Skip to content

APX: Add R_X86_64_CODE_4_GOTPCRELX

H.J. Lu requested to merge usr/hjl/apx/gotpcrelx-v3 into master

Intel Advanced Performance Extensions:

https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-performance-extensions-apx.html

adds the REX2 prefix for the additional general-purpose registers, r16-r31, in

mov        name@GOTPCREL(%rip), %reg
test       %reg, name@GOTPCREL(%rip)
binop      name@GOTPCREL(%rip), %reg

where binop is one of adc, add, add, cmp, or, sbb, sub, xor instructions. Add

define R_X86_64_CODE_4_GOTPCRELX 43

if the instruction starts at 4 bytes before the relocation offset. It is similar to R_X86_64_GOTPCRELX. Linker can treat R_X86_64_CODE_4_GOTPCRELX as R_X86_64_GOTPCREL or convert the above instructions to

lea	name(%rip), %reg
mov	$name, %reg
test	$name, %reg
binop	$name, %reg

if the first byte of the instruction at the relocation offset - 4 is 0xd5 when possible.

Merge request reports