Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 067cd9e

Browse files
committed
IR: Represent -ggnu-pubnames with a flag on the DICompileUnit.
This allows the flag to be persisted through to LTO. Differential Revision: https://reviews.llvm.org/D37655 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313078 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6370edb commit 067cd9e

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

include/clang/Driver/Options.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group<g_flags_Group>;
15961596
def gcolumn_info : Flag<["-"], "gcolumn-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
15971597
def gno_column_info : Flag<["-"], "gno-column-info">, Group<g_flags_Group>, Flags<[CoreOption]>;
15981598
def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group<g_flags_Group>;
1599-
def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>;
1599+
def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group<g_flags_Group>, Flags<[CC1Option]>;
16001600
def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group<g_flags_Group>;
16011601
def gmodules : Flag <["-"], "gmodules">, Group<gN_Group>,
16021602
HelpText<"Generate debug info with external references to clang modules"

include/clang/Frontend/CodeGenOptions.def

+3
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ CODEGENOPT(DebugInfoForProfiling, 1, 0)
287287
/// Whether 3-component vector type is preserved.
288288
CODEGENOPT(PreserveVec3Type, 1, 0)
289289

290+
/// Whether to emit .debug_gnu_pubnames section instead of .debug_pubnames.
291+
CODEGENOPT(GnuPubnames, 1, 0)
292+
290293
#undef CODEGENOPT
291294
#undef ENUM_CODEGENOPT
292295
#undef VALUE_CODEGENOPT

lib/CodeGen/CGDebugInfo.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ void CGDebugInfo::CreateCompileUnit() {
562562
Producer, LO.Optimize || CGOpts.PrepareForLTO || CGOpts.EmitSummaryIndex,
563563
CGOpts.DwarfDebugFlags, RuntimeVers,
564564
CGOpts.EnableSplitDwarf ? "" : CGOpts.SplitDwarfFile, EmissionKind,
565-
0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling);
565+
0 /* DWOid */, CGOpts.SplitDwarfInlining, CGOpts.DebugInfoForProfiling,
566+
CGOpts.GnuPubnames);
566567
}
567568

568569
llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) {

lib/Driver/ToolChains/Clang.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -2952,10 +2952,8 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
29522952
CmdArgs.push_back("-debug-info-macro");
29532953

29542954
// -ggnu-pubnames turns on gnu style pubnames in the backend.
2955-
if (Args.hasArg(options::OPT_ggnu_pubnames)) {
2956-
CmdArgs.push_back("-backend-option");
2957-
CmdArgs.push_back("-generate-gnu-dwarf-pub-sections");
2958-
}
2955+
if (Args.hasArg(options::OPT_ggnu_pubnames))
2956+
CmdArgs.push_back("-ggnu-pubnames");
29592957

29602958
// -gdwarf-aranges turns on the emission of the aranges section in the
29612959
// backend.

lib/Frontend/CompilerInvocation.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
564564
Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
565565
Opts.DebugInfoForProfiling = Args.hasFlag(
566566
OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false);
567+
Opts.GnuPubnames = Args.hasArg(OPT_ggnu_pubnames);
567568

568569
setPGOInstrumentor(Opts, Args, Diags);
569570
Opts.InstrProfileOutput =

test/Driver/debug-options.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
//
220220
// GIGNORE-NOT: "argument unused during compilation"
221221
//
222-
// GOPT: -generate-gnu-dwarf-pub-sections
222+
// GOPT: -ggnu-pubnames
223223
//
224224
// GARANGE: -generate-arange-section
225225
//

0 commit comments

Comments
 (0)