Skip to content

Commit dd41705

Browse files
committed
[BOLT] Use opts::Verbosity in PointerAuthCFIAnalyzer
1 parent 43b2e4c commit dd41705

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

bolt/lib/Passes/PointerAuthCFIAnalyzer.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
using namespace llvm;
3030

31+
namespace opts {
32+
extern llvm::cl::opt<unsigned> Verbosity;
33+
} // namespace opts
34+
3135
namespace llvm {
3236
namespace bolt {
3337

@@ -44,9 +48,10 @@ bool PointerAuthCFIAnalyzer::runOnFunction(BinaryFunction &BF) {
4448
// we expect psign/pauth instructions to have the hasNegateRAState
4549
// annotation.
4650
BF.setIgnored();
47-
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
48-
<< BF.getPrintName()
49-
<< ": ptr sign/auth inst without .cfi_negate_ra_state\n";
51+
if (opts::Verbosity >= 1)
52+
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
53+
<< BF.getPrintName()
54+
<< ": ptr sign/auth inst without .cfi_negate_ra_state\n";
5055
return false;
5156
}
5257
}
@@ -64,19 +69,21 @@ bool PointerAuthCFIAnalyzer::runOnFunction(BinaryFunction &BF) {
6469
if (BC.MIB->isPSignOnLR(Inst)) {
6570
if (RAState) {
6671
// RA signing instructions should only follow unsigned RA state.
67-
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
68-
<< BF.getPrintName()
69-
<< ": ptr signing inst encountered in Signed RA state\n";
72+
if (opts::Verbosity >= 1)
73+
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
74+
<< BF.getPrintName()
75+
<< ": ptr signing inst encountered in Signed RA state\n";
7076
BF.setIgnored();
7177
return false;
7278
}
7379
} else if (BC.MIB->isPAuthOnLR(Inst)) {
7480
if (!RAState) {
7581
// RA authenticating instructions should only follow signed RA state.
76-
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
77-
<< BF.getPrintName()
78-
<< ": ptr authenticating inst encountered in Unsigned RA "
79-
"state\n";
82+
if (opts::Verbosity >= 1)
83+
BC.outs() << "BOLT-INFO: inconsistent RAStates in function "
84+
<< BF.getPrintName()
85+
<< ": ptr authenticating inst encountered in Unsigned RA "
86+
"state\n";
8087
BF.setIgnored();
8188
return false;
8289
}

bolt/test/AArch64/negate-ra-state-incorrect.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
1010
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
11-
# RUN: llvm-bolt %t.exe -o %t.exe.bolt --no-threads | FileCheck %s --check-prefix=CHECK-BOLT
11+
# RUN: llvm-bolt %t.exe -o %t.exe.bolt -v=1 --no-threads | FileCheck %s --check-prefix=CHECK-BOLT
1212

1313
# CHECK-BOLT: BOLT-INFO: inconsistent RAStates in function foo: ptr authenticating inst encountered in Unsigned RA state
1414
# CHECK-BOLT: BOLT-INFO: inconsistent RAStates in function bar: ptr signing inst encountered in Signed RA state

0 commit comments

Comments
 (0)