Skip to content
  • H.J. Lu's avatar
    APX: Add R_X86_64_CODE_4_GOTPCRELX · 357de358
    H.J. Lu authored
    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.
    357de358