[llvm] Revert "[BOLT] Remove --allow-stripped option" (PR #93238)
Amir Ayupov via llvm-commits
llvm-commits at lists.llvm.org
Thu May 23 14:04:27 PDT 2024
https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/93238
This reverts commit ccabbfff86a00a0b211f5d0835916a1250ebcf0f.
Reintroduce allow-stripped as a fallback mechanism after enforcement of
HasSymbolsWithFileName was fixed in
https://github.com/llvm/llvm-project/pull/92625.
>From 13b73e53b043a620804873b83eeae8d6dfc1a353 Mon Sep 17 00:00:00 2001
From: Amir Ayupov <aaupov at fb.com>
Date: Thu, 23 May 2024 13:59:38 -0700
Subject: [PATCH] Revert "[BOLT] Remove --allow-stripped option"
This reverts commit ccabbfff86a00a0b211f5d0835916a1250ebcf0f.
Reintroduce allow-stripped as a fallback mechanism after enforcement of
HasSymbolsWithFileName was fixed in
https://github.com/llvm/llvm-project/pull/92625.
---
bolt/lib/Rewrite/RewriteInstance.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 2816f669a149c..70831f4b3787c 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -105,6 +105,12 @@ cl::opt<std::string>
"output binary via bolt info section"),
cl::cat(BoltCategory));
+cl::opt<bool>
+AllowStripped("allow-stripped",
+ cl::desc("allow processing of stripped binaries"),
+ cl::Hidden,
+ cl::cat(BoltCategory));
+
cl::opt<bool> DumpDotAll(
"dump-dot-all",
cl::desc("dump function CFGs to graphviz format after each stage;"
@@ -3206,12 +3212,14 @@ void RewriteInstance::preprocessProfileData() {
if (Error E = ProfileReader->preprocessProfile(*BC.get()))
report_error("cannot pre-process profile", std::move(E));
- if (!BC->hasSymbolsWithFileName() && ProfileReader->hasLocalsWithFileName()) {
+ if (!BC->hasSymbolsWithFileName() && ProfileReader->hasLocalsWithFileName() &&
+ !opts::AllowStripped) {
BC->errs()
<< "BOLT-ERROR: input binary does not have local file symbols "
"but profile data includes function names with embedded file "
"names. It appears that the input binary was stripped while a "
- "profiled binary was not\n";
+ "profiled binary was not. If you know what you are doing and "
+ "wish to proceed, use -allow-stripped option.\n";
exit(1);
}
}
More information about the llvm-commits
mailing list