From 05e62b507a68c1e22308fee49a2a80d3fb5bc103 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 24 Mar 2014 20:53:02 +0000 Subject: [PATCH] DebugInfo: Don't emit relocations to abbreviations in debug_info.dwo git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204667 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 2 +- lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 6 +++++- test/DebugInfo/X86/fission-cu.ll | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index e396ff9a7f4..eb769fe7ae3 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2690,7 +2690,7 @@ DwarfTypeUnit *DwarfDebug::constructSkeletonTU(DwarfTypeUnit *TU) { // compile units that would normally be in debug_info. void DwarfDebug::emitDebugInfoDWO() { assert(useSplitDwarf() && "No split dwarf debug info?"); - InfoHolder.emitUnits(this, DwarfAbbrevDWOSectionSym); + InfoHolder.emitUnits(this, nullptr); } // Emit the .debug_abbrev.dwo section for separated dwarf. This contains the diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 4a2b62421dd..86005cd3d80 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -2037,7 +2037,11 @@ void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const { // We share one abbreviations table across all units so it's always at the // start of the section. Use a relocatable offset where needed to ensure // linking doesn't invalidate that offset. - Asm->EmitSectionOffset(ASectionSym, ASectionSym); + if (ASectionSym) + Asm->EmitSectionOffset(ASectionSym, ASectionSym); + else + // Use a constant value in the dwo file, to avoid relocations + Asm->EmitInt32(0); Asm->OutStreamer.AddComment("Address Size (in bytes)"); Asm->EmitInt8(Asm->getDataLayout().getPointerSize()); } diff --git a/test/DebugInfo/X86/fission-cu.ll b/test/DebugInfo/X86/fission-cu.ll index 1591deee5ee..f1b2acf10b9 100644 --- a/test/DebugInfo/X86/fission-cu.ll +++ b/test/DebugInfo/X86/fission-cu.ll @@ -110,5 +110,6 @@ ; OBJ-NEXT: } ; HDR-NOT: .debug_aranges +; HDR-NOT: .rela.{{.*}}.dwo !9 = metadata !{i32 1, metadata !"Debug Info Version", i32 1} -- 2.34.1