From cbce34af0a3dae454fb557ac9f168feac692bc7f Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 12 Nov 2020 17:01:30 +0100 Subject: [PATCH] aarch64/inst/unwind.rs: handle zero-length prologues correctly. --- cranelift/codegen/src/isa/aarch64/inst/unwind.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cranelift/codegen/src/isa/aarch64/inst/unwind.rs b/cranelift/codegen/src/isa/aarch64/inst/unwind.rs index 265dd3fb60ce..ff6634ad47b6 100644 --- a/cranelift/codegen/src/isa/aarch64/inst/unwind.rs +++ b/cranelift/codegen/src/isa/aarch64/inst/unwind.rs @@ -102,7 +102,12 @@ impl UnwindInfoGenerator for AArch64UnwindInfo { // TODO epilogues - let prologue_size = context.insts_layout[context.prologue.end as usize - 1]; + let prologue_size = if context.prologue.is_empty() { + 0 + } else { + context.insts_layout[context.prologue.end as usize - 1] + }; + Ok(Some(UnwindInfo { prologue_size, prologue_unwind_codes: codes,