Skip to content

Commit 1ac054c

Browse files
committed
[CLANG][DWARF] Do not emit -ggnu-pubnames for split dwarf version 5.
When -gsplit-dwarf is passed in clang emmmits -ggnu-pubnames which results in .debug_gnu_pubnames/..debug_gnu_pubtypes being generated. For DWARF5 we have functional .debug_names. TBH not sure what the right behavior should be. Should we not generate anything at all by default or generate .debug_names? Doing some archeological digging initially -gnu-pubnames was always generated to be in line with what gcc does.. It was then changed so that it was generated when split-dwarf was enabled: 6586452#diff-bac41c71569f27df21a843bcd74d2e604ed508afbdf141777761dfb545c5d228 For LLDB these gnu sections are not useful and just waste space. Maybe a better check is to be based on tunning?
1 parent 113052b commit 1ac054c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4479,9 +4479,10 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
44794479
options::OPT_gpubnames, options::OPT_gno_pubnames);
44804480
if (DwarfFission != DwarfFissionKind::None ||
44814481
(PubnamesArg && checkDebugInfoOption(PubnamesArg, Args, D, TC)))
4482-
if (!PubnamesArg ||
4483-
(!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) &&
4484-
!PubnamesArg->getOption().matches(options::OPT_gno_pubnames)))
4482+
if (EffectiveDWARFVersion < 5 &&
4483+
(!PubnamesArg ||
4484+
(!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) &&
4485+
!PubnamesArg->getOption().matches(options::OPT_gno_pubnames))))
44854486
CmdArgs.push_back(PubnamesArg && PubnamesArg->getOption().matches(
44864487
options::OPT_gpubnames)
44874488
? "-gpubnames"

clang/test/Driver/split-debug.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// NOINLINE-NOT: "-fsplit-dwarf-inlining"
1212
// SPLIT-NOT: "-dumpdir"
1313
// SPLIT: "-debug-info-kind=constructor"
14-
// SPLIT-SAME: "-ggnu-pubnames"
1514
// SPLIT-SAME: "-split-dwarf-file" "split-debug.dwo" "-split-dwarf-output" "split-debug.dwo"
1615

1716
// RUN: %clang -### -c -target wasm32 -gsplit-dwarf -g %s 2>&1 | FileCheck %s --check-prefix=SPLIT

0 commit comments

Comments
 (0)