Skip to content

Commit 2e6f722

Browse files
authored
[BOLT] Move instrumentation option check (NFC) (#71581)
Move options check from emitBinary to more proper adjustCommandLineOptions.
1 parent 6643294 commit 2e6f722

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ void InstrumentationRuntimeLibrary::adjustCommandLineOptions(
5757
"the input binary\n";
5858
exit(1);
5959
}
60+
61+
if (BC.IsStaticExecutable && !opts::InstrumentationSleepTime) {
62+
errs() << "BOLT-ERROR: instrumentation of static binary currently does not "
63+
"support profile output on binary finalization, so it "
64+
"requires -instrumentation-sleep-time=N (N>0) usage\n";
65+
exit(1);
66+
}
67+
6068
if (!BC.FiniFunctionAddress && !BC.IsStaticExecutable) {
6169
errs() << "BOLT-ERROR: input binary lacks DT_FINI entry in the dynamic "
6270
"section but instrumentation currently relies on patching "
@@ -89,13 +97,6 @@ void InstrumentationRuntimeLibrary::emitBinary(BinaryContext &BC,
8997
"__BOLT", "__counters", MachO::S_REGULAR,
9098
SectionKind::getData()));
9199

92-
if (BC.IsStaticExecutable && !opts::InstrumentationSleepTime) {
93-
errs() << "BOLT-ERROR: instrumentation of static binary currently does not "
94-
"support profile output on binary finalization, so it "
95-
"requires -instrumentation-sleep-time=N (N>0) usage\n";
96-
exit(1);
97-
}
98-
99100
Section->setAlignment(llvm::Align(BC.RegularPageSize));
100101
Streamer.switchSection(Section);
101102

0 commit comments

Comments
 (0)