mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
Move Split DWARF handling to an MC option/command line argument rather than using metadata
Since Split DWARF needs to name the actual .dwo file that is generated, it can't be known at the time the llvm::Module is produced as it may be merged with other Modules before the object is generated and that object may be generated with any name. By passing the Split DWARF file name when LLVM is producing object code the .dwo file name in the object file can match correctly. The support for Split DWARF for implicit modules remains the same - using metadata to store the dwo name and dwo id so that potentially multiple skeleton CUs referring to different dwo files can be generated from one llvm::Module. llvm-svn: 301062
This commit is contained in:
parent
575aaa1960
commit
8ad792d2de
@ -54,6 +54,7 @@ public:
|
||||
int DwarfVersion = 0;
|
||||
|
||||
std::string ABIName;
|
||||
std::string SplitDwarfFile;
|
||||
|
||||
/// Additional paths to search for `.include` directives when using the
|
||||
/// integrated assembler.
|
||||
|
@ -90,14 +90,6 @@ DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
|
||||
clEnumVal(Disable, "Disabled")),
|
||||
cl::init(Default));
|
||||
|
||||
static cl::opt<DefaultOnOff>
|
||||
SplitDwarf("split-dwarf", cl::Hidden,
|
||||
cl::desc("Output DWARF5 split debug info."),
|
||||
cl::values(clEnumVal(Default, "Default for platform"),
|
||||
clEnumVal(Enable, "Enabled"),
|
||||
clEnumVal(Disable, "Disabled")),
|
||||
cl::init(Default));
|
||||
|
||||
static cl::opt<DefaultOnOff>
|
||||
DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
|
||||
cl::desc("Generate DWARF pubnames and pubtypes sections"),
|
||||
@ -253,11 +245,8 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
|
||||
|
||||
HasAppleExtensionAttributes = tuneForLLDB();
|
||||
|
||||
// Handle split DWARF. Off by default for now.
|
||||
if (SplitDwarf == Default)
|
||||
HasSplitDwarf = false;
|
||||
else
|
||||
HasSplitDwarf = SplitDwarf == Enable;
|
||||
// Handle split DWARF.
|
||||
HasSplitDwarf = !Asm->TM.Options.MCOptions.SplitDwarfFile.empty();
|
||||
|
||||
// Pubnames/pubtypes on by default for GDB.
|
||||
if (DwarfPubSections == Default)
|
||||
@ -412,7 +401,7 @@ DwarfDebug::constructDwarfCompileUnit(const DICompileUnit *DIUnit) {
|
||||
if (useSplitDwarf()) {
|
||||
NewCU.setSkeleton(constructSkeletonCU(NewCU));
|
||||
NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
|
||||
DIUnit->getSplitDebugFilename());
|
||||
Asm->TM.Options.MCOptions.SplitDwarfFile);
|
||||
}
|
||||
|
||||
// LTO with assembly output shares a single line table amongst multiple CUs.
|
||||
@ -1885,7 +1874,7 @@ void DwarfDebug::emitDebugMacinfo() {
|
||||
void DwarfDebug::initSkeletonUnit(const DwarfUnit &U, DIE &Die,
|
||||
std::unique_ptr<DwarfCompileUnit> NewU) {
|
||||
NewU->addString(Die, dwarf::DW_AT_GNU_dwo_name,
|
||||
U.getCUNode()->getSplitDebugFilename());
|
||||
Asm->TM.Options.MCOptions.SplitDwarfFile);
|
||||
|
||||
if (!CompilationDir.empty())
|
||||
NewU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
|
||||
|
@ -1,16 +1,16 @@
|
||||
; RUN: llc -split-dwarf=Disable -dwarf-version=4 -generate-type-units \
|
||||
; RUN: llc -dwarf-version=4 -generate-type-units \
|
||||
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SINGLE-4
|
||||
|
||||
; RUN: llc -split-dwarf=Enable -dwarf-version=4 -generate-type-units \
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -dwarf-version=4 -generate-type-units \
|
||||
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SPLIT-4
|
||||
|
||||
; RUN: llc -split-dwarf=Disable -dwarf-version=5 -generate-type-units \
|
||||
; RUN: llc -dwarf-version=5 -generate-type-units \
|
||||
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SINGLE-5
|
||||
|
||||
; RUN: llc -split-dwarf=Enable -dwarf-version=5 -generate-type-units \
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -dwarf-version=5 -generate-type-units \
|
||||
; RUN: -filetype=obj -O0 -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: | llvm-dwarfdump - | FileCheck %s --check-prefix=SPLIT-5
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
; REQUIRES: object-emission
|
||||
|
||||
; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s
|
||||
; RUN: %llc_dwarf -split-dwarf=Enable < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
|
||||
; RUN: %llc_dwarf -split-dwarf-file=foo.dwo < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
|
||||
|
||||
; darwin has a workaround for a linker bug so it always emits one line table entry
|
||||
; XFAIL: darwin
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -mtriple=powerpc64-unknown-linux-gnu -O0 -filetype=asm < %s | FileCheck %s
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -mtriple=powerpc64-unknown-linux-gnu -O0 -filetype=asm < %s | FileCheck %s
|
||||
|
||||
; FIXME: add relocation and DWARF expression support to llvm-dwarfdump & use
|
||||
; that here instead of raw assembly printing
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
|
||||
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=CHECK-RELOCS %s
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -function-sections -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=FUNCTION-SECTIONS %s
|
||||
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=FUNCTION-SECTIONS-RELOCS %s
|
||||
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=abbrev %t | FileCheck --check-prefix=NO-FUNCTION-SECTIONS %s
|
||||
|
||||
; From:
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -split-dwarf=Enable %s -o - | FileCheck %s
|
||||
; RUN: llc -mtriple=x86_64-pc-linux-gnu -split-dwarf-file=foo.dwo %s -o - | FileCheck %s
|
||||
; Derived from:
|
||||
|
||||
; int main (void) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llc -mtriple i686-pc-cygwin < %s -filetype=obj | llvm-dwarfdump - | FileCheck %s
|
||||
; RUN: llc -mtriple i686-pc-cygwin -split-dwarf=Enable < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
|
||||
; RUN: llc -mtriple i686-pc-cygwin -split-dwarf-file=foo.dwo < %s -filetype=obj | llvm-dwarfdump - | FileCheck --check-prefix=FISSION %s
|
||||
|
||||
; Expect no line table entry since there are no functions and file references in this compile unit
|
||||
; CHECK: .debug_line contents:
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=baz.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
|
||||
; RUN: llvm-readobj --relocations %t | FileCheck --check-prefix=OBJ %s
|
||||
; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s
|
||||
|
||||
; The source is an empty file.
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj > %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
||||
; RUN: llvm-objdump -r %t | FileCheck --check-prefix=RELOCS %s
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 < %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj | llvm-dwarfdump -debug-dump=info - | FileCheck %s
|
||||
|
||||
; CHECK-NOT: DW_TAG_subprogram
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump %t | FileCheck %s
|
||||
; RUN: llvm-objdump -h %t | FileCheck --check-prefix=HDR %s
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
; RUN: llvm-dwarfdump %t | FileCheck --check-prefix=CHECK --check-prefix=SINGLE %s
|
||||
; RUN: llvm-readobj -s -t %t | FileCheck --check-prefix=OBJ_SINGLE %s
|
||||
|
||||
; RUN: llc < %s -split-dwarf=Enable -o %t -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu
|
||||
; RUN: llc < %s -split-dwarf-file=foo.dwo -o %t -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu
|
||||
; RUN: llvm-dwarfdump %t | FileCheck --check-prefix=CHECK --check-prefix=FISSION %s
|
||||
; RUN: llvm-readobj -s -t %t | FileCheck --check-prefix=OBJ_FISSION %s
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: llc -split-dwarf=Enable -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -O0 %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o %t
|
||||
; RUN: llvm-dwarfdump -debug-dump=all %t | FileCheck %s --check-prefix=CHECK-DWO
|
||||
|
||||
; Based on the debuginfo-tests/sret.cpp code.
|
||||
|
@ -4,7 +4,7 @@
|
||||
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=i386-linux-gnu \
|
||||
; RUN: | FileCheck --check-prefix=NOEMU --check-prefix=SINGLE --check-prefix=SINGLE-32 --check-prefix=GNUOP %s
|
||||
|
||||
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu -split-dwarf=Enable \
|
||||
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-unknown-linux-gnu -split-dwarf-file=foo.dwo \
|
||||
; RUN: | FileCheck --check-prefix=NOEMU --check-prefix=FISSION --check-prefix=GNUOP %s
|
||||
|
||||
; RUN: llc %s -o - -filetype=asm -O0 -mtriple=x86_64-scei-ps4 \
|
||||
|
@ -1,9 +1,9 @@
|
||||
; REQUIRES: object-emission
|
||||
|
||||
; RUN: llc -split-dwarf=Enable -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: llc -split-dwarf-file=foo.dwo -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: | llvm-dwarfdump - | FileCheck %s
|
||||
|
||||
; RUN: llc -split-dwarf=Disable -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: llc -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
|
||||
; RUN: | llvm-dwarfdump - | FileCheck --check-prefix=SINGLE %s
|
||||
|
||||
; Test case built from:
|
||||
|
@ -90,6 +90,11 @@ OptLevel("O",
|
||||
static cl::opt<std::string>
|
||||
TargetTriple("mtriple", cl::desc("Override target triple for module"));
|
||||
|
||||
static cl::opt<std::string> SplitDwarfFile(
|
||||
"split-dwarf-file",
|
||||
cl::desc(
|
||||
"Specify the name of the .dwo file to encode in the DWARF output"));
|
||||
|
||||
static cl::opt<bool> NoVerify("disable-verify", cl::Hidden,
|
||||
cl::desc("Do not verify input module"));
|
||||
|
||||
@ -450,6 +455,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||
Options.MCOptions.AsmVerbose = AsmVerbose;
|
||||
Options.MCOptions.PreserveAsmComments = PreserveComments;
|
||||
Options.MCOptions.IASSearchPaths = IncludeDirs;
|
||||
Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
|
||||
|
||||
std::unique_ptr<TargetMachine> Target(
|
||||
TheTarget->createTargetMachine(TheTriple.getTriple(), CPUStr, FeaturesStr,
|
||||
|
Loading…
Reference in New Issue
Block a user