Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions bolt/include/bolt/Core/BinaryContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ class BinaryContext {
/// Newly created segments.
std::vector<SegmentInfo> NewSegments;

/// Symbols that are expected to be undefined in MCContext during emission.
std::unordered_set<MCSymbol *> UndefinedSymbols;

/// [name] -> [BinaryData*] map used for global symbol resolution.
using SymbolMapType = StringMap<BinaryData *>;
SymbolMapType GlobalSymbols;
Expand Down
18 changes: 0 additions & 18 deletions bolt/lib/Core/BinaryFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1896,16 +1896,6 @@ bool BinaryFunction::scanExternalRefs() {
}
}

// Inform BinaryContext that this function symbols will not be defined and
// relocations should not be created against them.
if (BC.HasRelocations) {
for (std::pair<const uint32_t, MCSymbol *> &LI : Labels)
BC.UndefinedSymbols.insert(LI.second);
for (MCSymbol *const EndLabel : FunctionEndLabels)
if (EndLabel)
BC.UndefinedSymbols.insert(EndLabel);
}

clearList(Relocations);
clearList(ExternallyReferencedOffsets);

Expand Down Expand Up @@ -3234,14 +3224,6 @@ void BinaryFunction::clearDisasmState() {
clearList(Instructions);
clearList(IgnoredBranches);
clearList(TakenBranches);

if (BC.HasRelocations) {
for (std::pair<const uint32_t, MCSymbol *> &LI : Labels)
BC.UndefinedSymbols.insert(LI.second);
for (MCSymbol *const EndLabel : FunctionEndLabels)
if (EndLabel)
BC.UndefinedSymbols.insert(EndLabel);
}
}

void BinaryFunction::setTrapOnEntry() {
Expand Down
6 changes: 4 additions & 2 deletions bolt/lib/Core/BinarySection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ void BinarySection::emitAsData(MCStreamer &Streamer,
RI = ROE;

// Skip undefined symbols.
auto HasUndefSym = [this](const auto &Relocation) {
return BC.UndefinedSymbols.count(Relocation.Symbol);
auto HasUndefSym = [](const auto &Relocation) {
return Relocation.Symbol && Relocation.Symbol->isTemporary() &&
Relocation.Symbol->isUndefined() &&
!Relocation.Symbol->isRegistered();
};

if (std::any_of(ROI, ROE, HasUndefSym))
Expand Down
Loading