aboutsummaryrefslogtreecommitdiff
path: root/bolt/lib
diff options
context:
space:
mode:
Diffstat (limited to 'bolt/lib')
-rw-r--r--bolt/lib/Core/BinaryContext.cpp32
-rw-r--r--bolt/lib/Profile/DataAggregator.cpp7
-rw-r--r--bolt/lib/Profile/YAMLProfileWriter.cpp2
3 files changed, 29 insertions, 12 deletions
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index a383ced..7af32c8 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -78,6 +78,11 @@ cl::opt<std::string> CompDirOverride(
"to *.dwo files."),
cl::Hidden, cl::init(""), cl::cat(BoltCategory));
+static cl::opt<bool> CloneConstantIsland("clone-constant-island",
+ cl::desc("clone constant islands"),
+ cl::Hidden, cl::init(true),
+ cl::ZeroOrMore, cl::cat(BoltCategory));
+
static cl::opt<bool>
FailOnInvalidPadding("fail-on-invalid-padding", cl::Hidden, cl::init(false),
cl::desc("treat invalid code padding as error"),
@@ -461,7 +466,8 @@ BinaryContext::handleAddressRef(uint64_t Address, BinaryFunction &BF,
// of dynamic relocs, as we currently do not support cloning them.
// Notice: we might fail to link because of this, if the original constant
// island we are referring would be emitted too far away.
- if (IslandIter->second->hasDynamicRelocationAtIsland()) {
+ if (IslandIter->second->hasDynamicRelocationAtIsland() ||
+ !opts::CloneConstantIsland) {
MCSymbol *IslandSym =
IslandIter->second->getOrCreateIslandAccess(Address);
if (IslandSym)
@@ -469,6 +475,12 @@ BinaryContext::handleAddressRef(uint64_t Address, BinaryFunction &BF,
} else if (MCSymbol *IslandSym =
IslandIter->second->getOrCreateProxyIslandAccess(Address,
BF)) {
+ LLVM_DEBUG(
+ dbgs() << "BOLT-DEBUG: clone constant island at address 0x"
+ << Twine::utohexstr(IslandIter->first) << " with size of 0x"
+ << Twine::utohexstr(
+ IslandIter->second->estimateConstantIslandSize())
+ << " bytes, referenced by " << BF << "\n");
BF.createIslandDependency(IslandSym, IslandIter->second);
return std::make_pair(IslandSym, 0);
}
@@ -778,13 +790,17 @@ void BinaryContext::populateJumpTables() {
}
if (opts::StrictMode && DataPCRelocations.size()) {
- LLVM_DEBUG({
- dbgs() << DataPCRelocations.size()
- << " unclaimed PC-relative relocations left in data:\n";
- for (uint64_t Reloc : DataPCRelocations)
- dbgs() << Twine::utohexstr(Reloc) << '\n';
- });
- assert(0 && "unclaimed PC-relative relocations left in data\n");
+ this->errs() << "BOLT-ERROR: " << DataPCRelocations.size()
+ << " unclaimed PC-relative relocation(s) left in data";
+ if (opts::Verbosity) {
+ this->errs() << ":\n";
+ for (uint64_t RelocOffset : DataPCRelocations)
+ this->errs() << " @0x" << Twine::utohexstr(RelocOffset) << '\n';
+ } else {
+ this->errs() << ". Re-run with -v=1 to see the list\n";
+ }
+ this->errs() << "BOLT-ERROR: unable to proceed with --strict\n";
+ exit(1);
}
clearList(DataPCRelocations);
}
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index dc3d918..4e06203 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -1321,7 +1321,8 @@ std::error_code DataAggregator::parseAggregatedLBREntry() {
}
using SSI = StringSwitch<int>;
- AddrNum = SSI(Str).Cases("T", "R", 3).Case("S", 1).Case("E", 0).Default(2);
+ AddrNum =
+ SSI(Str).Cases({"T", "R"}, 3).Case("S", 1).Case("E", 0).Default(2);
CounterNum = SSI(Str).Case("B", 2).Case("E", 0).Default(1);
}
@@ -2215,7 +2216,7 @@ DataAggregator::writeAggregatedFile(StringRef OutputFilename) const {
OutFile << "boltedcollection\n";
if (opts::BasicAggregation) {
OutFile << "no_lbr";
- for (const StringMapEntry<std::nullopt_t> &Entry : EventNames)
+ for (const StringMapEntry<EmptyStringSetTag> &Entry : EventNames)
OutFile << " " << Entry.getKey();
OutFile << "\n";
@@ -2291,7 +2292,7 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC,
ListSeparator LS(",");
raw_string_ostream EventNamesOS(BP.Header.EventNames);
- for (const StringMapEntry<std::nullopt_t> &EventEntry : EventNames)
+ for (const StringMapEntry<EmptyStringSetTag> &EventEntry : EventNames)
EventNamesOS << LS << EventEntry.first().str();
BP.Header.Flags = opts::BasicAggregation ? BinaryFunction::PF_BASIC
diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp b/bolt/lib/Profile/YAMLProfileWriter.cpp
index 1632aa1..5c631f9 100644
--- a/bolt/lib/Profile/YAMLProfileWriter.cpp
+++ b/bolt/lib/Profile/YAMLProfileWriter.cpp
@@ -382,7 +382,7 @@ std::error_code YAMLProfileWriter::writeProfile(const RewriteInstance &RI) {
StringSet<> EventNames = RI.getProfileReader()->getEventNames();
if (!EventNames.empty()) {
std::string Sep;
- for (const StringMapEntry<std::nullopt_t> &EventEntry : EventNames) {
+ for (const StringMapEntry<EmptyStringSetTag> &EventEntry : EventNames) {
BP.Header.EventNames += Sep + EventEntry.first().str();
Sep = ",";
}