return WasRelaxed;
MCContext &Context = Layout.getAssembler().getContext();
- uint64_t OldSize = DF.getContents().size();
- int64_t AddrDelta;
- bool Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, Layout);
- assert(Abs && "We created call frame with an invalid expression");
- (void) Abs;
+ int64_t Value;
+ bool Abs = DF.getAddrDelta().evaluateAsAbsolute(Value, Layout);
+ if (!Abs) {
+ getContext().reportError(DF.getAddrDelta().getLoc(),
+ "invalid CFI advance_loc expression");
+ return false;
+ }
+
SmallVectorImpl<char> &Data = DF.getContents();
+ uint64_t OldSize = Data.size();
Data.clear();
DF.getFixups().clear();
- MCDwarfFrameEmitter::encodeAdvanceLoc(Context, AddrDelta, Data);
+ MCDwarfFrameEmitter::encodeAdvanceLoc(Context, Value, Data);
return OldSize != Data.size();
}
--- /dev/null
+# RUN: not llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o /dev/null 2>&1 | FileCheck %s --implicit-check-not=error:
+
+# CHECK-COUNT-4: <unknown>:0: error: invalid CFI advance_loc expression
+
+.section __TEXT,__text
+.globl _foo
+_foo:
+ .cfi_startproc
+ subq $8, %rsp
+ .cfi_adjust_cfa_offset 8
+ subq $8, %rsp
+ .cfi_adjust_cfa_offset 8
+
+tmp0: # non-private label cannot appear here
+ addq $8, %rsp
+ .cfi_adjust_cfa_offset -8
+.tmp1: # non-private label cannot appear here
+ addq $8, %rsp
+ .cfi_adjust_cfa_offset -8
+ retq
+ .cfi_endproc