[BOLT] Fix debug line info in lite relocation mode

Summary: Emit line info for functions that were not emitted in relocation mode.

(cherry picked from FBD24267650)
This commit is contained in:
Maksim Panchenko 2020-10-12 20:16:59 -07:00
parent 473a6199ab
commit 9f15b9f3c2
1 changed files with 6 additions and 5 deletions

View File

@ -177,7 +177,7 @@ private:
bool FirstInstr); bool FirstInstr);
/// Emit debug line information for functions that were not emitted. /// Emit debug line information for functions that were not emitted.
void emitDebugLineInfoForNonSimpleFunctions(); void emitDebugLineInfoForOriginalFunctions();
/// Emit function as a blob with relocations and labels for relocations. /// Emit function as a blob with relocations and labels for relocations.
void emitFunctionBodyRaw(BinaryFunction &BF) LLVM_ATTRIBUTE_UNUSED; void emitFunctionBodyRaw(BinaryFunction &BF) LLVM_ATTRIBUTE_UNUSED;
@ -199,8 +199,8 @@ void BinaryEmitter::emitAll(StringRef OrgSecPrefix) {
emitFunctions(); emitFunctions();
if (!BC.HasRelocations && opts::UpdateDebugSections) if (opts::UpdateDebugSections)
emitDebugLineInfoForNonSimpleFunctions(); emitDebugLineInfoForOriginalFunctions();
emitDataSections(OrgSecPrefix); emitDataSections(OrgSecPrefix);
@ -911,11 +911,12 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, bool EmitColdPart) {
} }
} }
void BinaryEmitter::emitDebugLineInfoForNonSimpleFunctions() { void BinaryEmitter::emitDebugLineInfoForOriginalFunctions() {
for (auto &It : BC.getBinaryFunctions()) { for (auto &It : BC.getBinaryFunctions()) {
const auto &Function = It.second; const auto &Function = It.second;
if (Function.isSimple()) // If the function was emitted, its line info was emitted with it.
if (Function.isEmitted())
continue; continue;
auto ULT = Function.getDWARFUnitLineTable(); auto ULT = Function.getDWARFUnitLineTable();