Cranelift AArch64: Fix the get_return_address lowering (#4851)
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.
This commit is contained in:
@@ -726,6 +726,8 @@ impl<'a> Verifier<'a> {
|
||||
opcode: Opcode::GetFramePointer | Opcode::GetReturnAddress,
|
||||
} => {
|
||||
if let Some(isa) = &self.isa {
|
||||
// Backends may already rely on this check implicitly, so do
|
||||
// not relax it without verifying that it is safe to do so.
|
||||
if !isa.flags().preserve_frame_pointers() {
|
||||
return errors.fatal((
|
||||
inst,
|
||||
|
||||
Reference in New Issue
Block a user