Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion bolt/lib/Core/BinaryContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -461,14 +466,21 @@ 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)
return std::make_pair(IslandSym, 0);
} 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);
}
Expand Down
Loading