diff options
Diffstat (limited to 'bolt/lib')
| -rw-r--r-- | bolt/lib/Core/BinaryFunction.cpp | 13 | ||||
| -rw-r--r-- | bolt/lib/Rewrite/RewriteInstance.cpp | 4 |
2 files changed, 7 insertions, 10 deletions
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index 776f4ae..84023ef 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -1035,13 +1035,9 @@ BinaryFunction::processIndirectBranch(MCInst &Instruction, unsigned Size, return BranchType; } -MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address, - bool CreatePastEnd) { +MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address) { const uint64_t Offset = Address - getAddress(); - if ((Offset == getSize()) && CreatePastEnd) - return getFunctionEndLabel(); - auto LI = Labels.find(Offset); if (LI != Labels.end()) return LI->second; @@ -1052,6 +1048,9 @@ MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address, return IslandSym; } + if (Offset == getSize()) + return getFunctionEndLabel(); + MCSymbol *Label = BC.Ctx->createNamedTempSymbol(); Labels[Offset] = Label; @@ -1994,7 +1993,7 @@ void BinaryFunction::postProcessJumpTables() { if (IsBuiltinUnreachable) { BinaryFunction *TargetBF = BC.getBinaryFunctionAtAddress(EntryAddress); MCSymbol *Label = TargetBF ? TargetBF->getSymbol() - : getOrCreateLocalLabel(EntryAddress, true); + : getOrCreateLocalLabel(EntryAddress); JT.Entries.push_back(Label); continue; } @@ -2005,7 +2004,7 @@ void BinaryFunction::postProcessJumpTables() { BC.getBinaryFunctionContainingAddress(EntryAddress); MCSymbol *Label; if (HasOneParent && TargetBF == this) { - Label = getOrCreateLocalLabel(EntryAddress, true); + Label = getOrCreateLocalLabel(EntryAddress); } else { const uint64_t Offset = EntryAddress - TargetBF->getAddress(); Label = Offset ? TargetBF->addEntryPointAtOffset(Offset) diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 6fa66ab..77e5688 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -2949,9 +2949,7 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection, ReferencedSymbol = ReferencedBF->addEntryPointAtOffset(RefFunctionOffset); } else { - ReferencedSymbol = - ReferencedBF->getOrCreateLocalLabel(Address, - /*CreatePastEnd =*/true); + ReferencedSymbol = ReferencedBF->getOrCreateLocalLabel(Address); // If ContainingBF != nullptr, it equals ReferencedBF (see // if-condition above) so we're handling a relocation from a function |
