Browse Source
The previous implementation assumed that nothing had clobbered the LR register since the current function had started executing, so it would be incorrect for a non-leaf function, for example, that contains the `get_return_address` operation right after a call. The operation is valid only if the `preserve_frame_pointers` flag is enabled, which implies that the presence of a frame record on the stack is guaranteed. Copyright (c) 2022, Arm Limited.pull/4880/head
Anton Kirilov
2 years ago
committed by
GitHub
7 changed files with 97 additions and 11 deletions
@ -0,0 +1,47 @@ |
|||
test compile precise-output |
|||
set preserve_frame_pointers=true |
|||
target aarch64 sign_return_address |
|||
|
|||
function %fp() -> i64 { |
|||
block0: |
|||
v0 = get_frame_pointer.i64 |
|||
return v0 |
|||
} |
|||
|
|||
; paciasp |
|||
; stp fp, lr, [sp, #-16]! |
|||
; mov fp, sp |
|||
; block0: |
|||
; mov x0, fp |
|||
; ldp fp, lr, [sp], #16 |
|||
; autiasp ; ret |
|||
|
|||
function %sp() -> i64 { |
|||
block0: |
|||
v0 = get_stack_pointer.i64 |
|||
return v0 |
|||
} |
|||
|
|||
; paciasp |
|||
; stp fp, lr, [sp, #-16]! |
|||
; mov fp, sp |
|||
; block0: |
|||
; mov x0, sp |
|||
; ldp fp, lr, [sp], #16 |
|||
; autiasp ; ret |
|||
|
|||
function %return_address() -> i64 { |
|||
block0: |
|||
v0 = get_return_address.i64 |
|||
return v0 |
|||
} |
|||
|
|||
; paciasp |
|||
; stp fp, lr, [sp, #-16]! |
|||
; mov fp, sp |
|||
; block0: |
|||
; ldr lr, [fp, #8] |
|||
; xpaclri |
|||
; mov x0, lr |
|||
; ldp fp, lr, [sp], #16 |
|||
; autiasp ; ret |
Loading…
Reference in new issue