@@ -114,20 +114,23 @@ void InsertNegateRAState::inferUnknownStates(BinaryFunction &BF) {
114114}
115115
116116Error InsertNegateRAState::runOnFunctions (BinaryContext &BC) {
117+ std::atomic<uint64_t > FunctionsModified{0 };
117118 ParallelUtilities::WorkFuncTy WorkFun = [&](BinaryFunction &BF) {
118- if (BF.containedNegateRAState () && !BF.isIgnored ()) {
119- // We can skip functions which did not include negate-ra-state CFIs. This
120- // includes code using pac-ret hardening as well, if the binary is
121- // compiled with `-fno-exceptions -fno-unwind-tables
122- // -fno-asynchronous-unwind-tables`
123- FunctionsModified++;
124- runOnFunction (BF);
125- }
119+ FunctionsModified++;
120+ runOnFunction (BF);
121+ };
122+
123+ ParallelUtilities::PredicateTy SkipPredicate = [&](const BinaryFunction &BF) {
124+ // We can skip functions which did not include negate-ra-state CFIs. This
125+ // includes code using pac-ret hardening as well, if the binary is
126+ // compiled with `-fno-exceptions -fno-unwind-tables
127+ // -fno-asynchronous-unwind-tables`
128+ return !BF.containedNegateRAState () || BF.isIgnored ();
126129 };
127130
128131 ParallelUtilities::runOnEachFunction (
129- BC, ParallelUtilities::SchedulingPolicy::SP_TRIVIAL, WorkFun, nullptr ,
130- " InsertNegateRAStatePass" );
132+ BC, ParallelUtilities::SchedulingPolicy::SP_TRIVIAL, WorkFun,
133+ SkipPredicate, " InsertNegateRAStatePass" );
131134
132135 BC.outs () << " BOLT-INFO: rewritten pac-ret DWARF info in "
133136 << FunctionsModified << " out of " << BC.getBinaryFunctions ().size ()
0 commit comments