File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1313#define BOLT_PASSES_MARK_RA_STATES
1414
1515#include " bolt/Passes/BinaryPasses.h"
16+ #include < mutex>
1617
1718namespace llvm {
1819namespace bolt {
1920
2021class MarkRAStates : public BinaryFunctionPass {
22+ // setIgnored() is not thread-safe, but the pass is running on functions in
23+ // parallel.
24+ std::mutex IgnoreMutex;
25+
2126public:
2227 explicit MarkRAStates () : BinaryFunctionPass(false ) {}
2328
Original file line number Diff line number Diff line change @@ -43,10 +43,11 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
4343 // Not all functions have .cfi_negate_ra_state in them. But if one does,
4444 // we expect psign/pauth instructions to have the hasNegateRAState
4545 // annotation.
46- BF.setIgnored ();
4746 BC.outs () << " BOLT-INFO: inconsistent RAStates in function "
4847 << BF.getPrintName ()
4948 << " : ptr sign/auth inst without .cfi_negate_ra_state\n " ;
49+ std::lock_guard<std::mutex> Lock (IgnoreMutex);
50+ BF.setIgnored ();
5051 return false ;
5152 }
5253 }
@@ -67,6 +68,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
6768 BC.outs () << " BOLT-INFO: inconsistent RAStates in function "
6869 << BF.getPrintName ()
6970 << " : ptr signing inst encountered in Signed RA state\n " ;
71+ std::lock_guard<std::mutex> Lock (IgnoreMutex);
7072 BF.setIgnored ();
7173 return false ;
7274 }
@@ -80,6 +82,7 @@ bool MarkRAStates::runOnFunction(BinaryFunction &BF) {
8082 << BF.getPrintName ()
8183 << " : ptr authenticating inst encountered in Unsigned RA "
8284 " state\n " ;
85+ std::lock_guard<std::mutex> Lock (IgnoreMutex);
8386 BF.setIgnored ();
8487 return false ;
8588 }
You can’t perform that action at this time.
0 commit comments