[PATCH] D59673: [Driver] Allow setting the DWO name DWARF attribute separately
Aaron Puchert via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 21 18:31:22 PDT 2019
aaronpuchert updated this revision to Diff 191813.
aaronpuchert added a comment.
Use llvm-dwarfdump to inspect debug info, remove unneeded flags.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59673/new/
https://reviews.llvm.org/D59673
Files:
include/clang/Basic/CodeGenOptions.h
include/clang/Driver/Options.td
lib/CodeGen/BackendUtil.cpp
lib/Frontend/CompilerInvocation.cpp
test/CodeGen/split-debug-dwo-name-attr.c
Index: test/CodeGen/split-debug-dwo-name-attr.c
===================================================================
--- /dev/null
+++ test/CodeGen/split-debug-dwo-name-attr.c
@@ -0,0 +1,8 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -enable-split-dwarf -split-dwarf-file %t -fsplit-dwarf-dwo-name-attr=foo.dwo -emit-obj -o - %s | llvm-dwarfdump -debug-info - | FileCheck %s
+// RUN: llvm-objdump -section-headers %t | FileCheck --check-prefix=DWO %s
+
+int f() { return 0; }
+
+// CHECK: DW_AT_GNU_dwo_name ("foo.dwo")
+// DWO: .dwo
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -714,6 +714,8 @@
Opts.WholeProgramVTables = Args.hasArg(OPT_fwhole_program_vtables);
Opts.LTOVisibilityPublicStd = Args.hasArg(OPT_flto_visibility_public_std);
Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
+ Opts.SplitDwarfDwoNameAttr =
+ Args.getLastArgValue(OPT_fsplit_dwarf_dwo_name_attr_EQ);
Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining);
if (Arg *A =
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -464,7 +464,9 @@
Options.EmitAddrsig = CodeGenOpts.Addrsig;
if (CodeGenOpts.getSplitDwarfMode() != CodeGenOptions::NoFission)
- Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
+ Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfDwoNameAttr.empty()
+ ? CodeGenOpts.SplitDwarfFile
+ : CodeGenOpts.SplitDwarfDwoNameAttr;
Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;
Options.MCOptions.MCSaveTempLabels = CodeGenOpts.SaveTempLabels;
Options.MCOptions.MCUseDwarfDirectory = !CodeGenOpts.NoDwarfDirectoryAsm;
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1849,6 +1849,8 @@
Flags<[CC1Option]>, HelpText<"Use DWARF base address selection entries in debug_ranges">;
def fno_debug_ranges_base_address: Flag <["-"], "fno-debug-ranges-base-address">, Group<f_Group>,
Flags<[CC1Option]>;
+def fsplit_dwarf_dwo_name_attr_EQ: Joined<["-"], "fsplit-dwarf-dwo-name-attr=">, Group<f_Group>,
+ Flags<[CC1Option]>, HelpText<"Set the name for the split debug info file to be used in the object file">;
def fsplit_dwarf_inlining: Flag <["-"], "fsplit-dwarf-inlining">, Group<f_Group>,
Flags<[CC1Option]>, HelpText<"Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF">;
def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group<f_Group>,
Index: include/clang/Basic/CodeGenOptions.h
===================================================================
--- include/clang/Basic/CodeGenOptions.h
+++ include/clang/Basic/CodeGenOptions.h
@@ -188,6 +188,10 @@
/// in the backend for setting the name in the skeleton cu.
std::string SplitDwarfFile;
+ /// Overrides \ref SplitDwarfFile as value of DW_AT_[GNU_]dwo_name to be used
+ /// in the skeleton CU, if not empty. Does not change the output file name.
+ std::string SplitDwarfDwoNameAttr;
+
/// The name of the relocation model to use.
llvm::Reloc::Model RelocationModel;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59673.191813.patch
Type: text/x-patch
Size: 3613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190322/2283b8b1/attachment-0001.bin>
More information about the cfe-commits
mailing list