diff --git a/compiler-rt/lib/xray/xray_trampoline_AArch64.S b/compiler-rt/lib/xray/xray_trampoline_AArch64.S --- a/compiler-rt/lib/xray/xray_trampoline_AArch64.S +++ b/compiler-rt/lib/xray/xray_trampoline_AArch64.S @@ -27,10 +27,10 @@ STP Q2, Q3, [SP, #-32]! STP Q4, Q5, [SP, #-32]! STP Q6, Q7, [SP, #-32]! - /* Load the address of _ZN6__xray19XRayPatchedFunctionE into X1 */ - LDR X1, =_ZN6__xray19XRayPatchedFunctionE + /* Load the page address of _ZN6__xray19XRayPatchedFunctionE into X1 */ + ADRP X1, _ZN6__xray19XRayPatchedFunctionE /* Load the handler function pointer into X2 */ - LDR X2, [X1] + LDR X2, [X1, #:lo12:_ZN6__xray19XRayPatchedFunctionE] /* Handler address is nullptr if handler is not set */ CMP X2, #0 BEQ FunctionEntry_restore @@ -72,10 +72,10 @@ STP X5, X6, [SP, #-16]! STP X7, X30, [SP, #-16]! STR Q0, [SP, #-16]! - /* Load the address of _ZN6__xray19XRayPatchedFunctionE into X1 */ - LDR X1, =_ZN6__xray19XRayPatchedFunctionE + /* Load the page address of _ZN6__xray19XRayPatchedFunctionE into X1 */ + ADRP X1, _ZN6__xray19XRayPatchedFunctionE /* Load the handler function pointer into X2 */ - LDR X2, [X1] + LDR X2, [X1, #:lo12:_ZN6__xray19XRayPatchedFunctionE] /* Handler address is nullptr if handler is not set */ CMP X2, #0 BEQ FunctionExit_restore @@ -117,10 +117,10 @@ STP Q2, Q3, [SP, #-32]! STP Q4, Q5, [SP, #-32]! STP Q6, Q7, [SP, #-32]! - /* Load the address of _ZN6__xray19XRayPatchedFunctionE into X1 */ - LDR X1, =_ZN6__xray19XRayPatchedFunctionE + /* Load the page address of _ZN6__xray19XRayPatchedFunctionE into X1 */ + ADRP X1, _ZN6__xray19XRayPatchedFunctionE /* Load the handler function pointer into X2 */ - LDR X2, [X1] + LDR X2, [X1, #:lo12:_ZN6__xray19XRayPatchedFunctionE] /* Handler address is nullptr if handler is not set */ CMP X2, #0 BEQ FunctionTailExit_restore diff --git a/compiler-rt/lib/xray/xray_trampoline_arm.S b/compiler-rt/lib/xray/xray_trampoline_arm.S --- a/compiler-rt/lib/xray/xray_trampoline_arm.S +++ b/compiler-rt/lib/xray/xray_trampoline_arm.S @@ -21,9 +21,9 @@ PUSH {r1-r3,lr} @ Save floating-point parameters of the instrumented function VPUSH {d0-d7} - MOVW r1,#:lower16:_ZN6__xray19XRayPatchedFunctionE - MOVT r1,#:upper16:_ZN6__xray19XRayPatchedFunctionE - LDR r2, [r1] + MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16) + MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12) + LDR r2, [pc, r1] @ Handler address is nullptr if handler is not set CMP r2, #0 BEQ FunctionEntry_restore @@ -53,9 +53,9 @@ @ Save the floating-point return value of the instrumented function VPUSH {d0} @ Load the handler address - MOVW r1,#:lower16:_ZN6__xray19XRayPatchedFunctionE - MOVT r1,#:upper16:_ZN6__xray19XRayPatchedFunctionE - LDR r2, [r1] + MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16) + MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12) + LDR r2, [pc, r1] @ Handler address is nullptr if handler is not set CMP r2, #0 BEQ FunctionExit_restore @@ -84,9 +84,9 @@ PUSH {r1-r3,lr} @ Save floating-point parameters of the instrumented function VPUSH {d0-d7} - MOVW r1,#:lower16:_ZN6__xray19XRayPatchedFunctionE - MOVT r1,#:upper16:_ZN6__xray19XRayPatchedFunctionE - LDR r2, [r1] + MOVW r1, #:lower16:_ZN6__xray19XRayPatchedFunctionE - (. + 16) + MOVT r1, #:upper16:_ZN6__xray19XRayPatchedFunctionE - (. + 12) + LDR r2, [pc, r1] @ Handler address is nullptr if handler is not set CMP r2, #0 BEQ FunctionTailExit_restore