Skip to content

Commit 59112e3

Browse files
committed
[BOLT] remove asserts from MarkRAStates
instead of failing on asserts, setIgnored() to functions with inconsistent input RA States
1 parent 2c17baa commit 59112e3

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

bolt/lib/Passes/MarkRAStates.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void MarkRAStates::runOnFunction(BinaryFunction &BF) {
5454
// authenticated, so functions always start with unsigned RAState when
5555
// working with compiler-generated code)
5656
BF.setIgnored();
57-
BC.outs() << "BOLT-INFO: ignoring RAStates in function "
57+
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
5858
<< BF.getPrintName() << "\n";
5959
return;
6060
}
@@ -72,10 +72,22 @@ void MarkRAStates::runOnFunction(BinaryFunction &BF) {
7272
continue;
7373

7474
if (BC.MIB->isPSign(Inst)) {
75-
assert(!RAState && "Signed RA State before PSign");
75+
if (RAState) {
76+
// RA signing instructions should only follow unsigned RA state.
77+
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
78+
<< BF.getPrintName() << "\n";
79+
BF.setIgnored();
80+
return;
81+
}
7682
BC.MIB->setRASigning(Inst);
7783
} else if (BC.MIB->isPAuth(Inst)) {
78-
assert(RAState && "Unsigned RA State before PAuth");
84+
if (!RAState) {
85+
// RA authenticating instructions should only follow signed RA state.
86+
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
87+
<< BF.getPrintName() << "\n";
88+
BF.setIgnored();
89+
return;
90+
}
7991
BC.MIB->setAuthenticating(Inst);
8092
} else if (RAState) {
8193
BC.MIB->setRASigned(Inst);

0 commit comments

Comments
 (0)