[PATCH] D44385: [DEBUGINFO] Add flag -no-dwarf-gnu-pub-sections to disable gnu pub sections.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 12 08:50:51 PDT 2018
1. It is required for correct debug info emission for NVPTX target.
2. Not sure, I'm not very familiar with this. Eric?
-------------
Best regards,
Alexey Bataev
12.03.2018 11:46, David Blaikie пишет:
> What's the use-case/motivation? Should this be an IR feature (on a
> per-CU basis, so that LTO can correctly respect some CUs requesting
> this feature, and some disabling it)
>
> On Mon, Mar 12, 2018 at 8:06 AM Alexey Bataev via Phabricator via
> llvm-commits <llvm-commits at lists.llvm.org
> <mailto:llvm-commits at lists.llvm.org>> wrote:
>
> ABataev created this revision.
> ABataev added reviewers: probinson, echristo.
> Herald added subscribers: JDevlieghere, aprantl.
>
> Added a flag -no-dwarf-gnu-pub-sections, which allows to disable
> emission of gnu public sections.
>
>
> Repository:
> rL LLVM
>
> https://reviews.llvm.org/D44385
> <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Freviews.llvm.org%2FD44385&data=02%7C01%7C%7Ce807747c01a941a740d008d588307cfa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636564664186820313&sdata=CPc5yC5ORdLnrc%2FpoIuOLd%2FjAZFjWEPiiOZVmoPWA%2Bs%3D&reserved=0>
>
> Files:
> lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> lib/CodeGen/AsmPrinter/DwarfDebug.h
> test/DebugInfo/X86/no-gnu-public-sections.ll
>
>
> Index: test/DebugInfo/X86/no-gnu-public-sections.ll
> ===================================================================
> --- /dev/null
> +++ test/DebugInfo/X86/no-gnu-public-sections.ll
> @@ -0,0 +1,31 @@
> +; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=gdb
> -filetype=asm < %s -no-dwarf-gnu-pub-sections | FileCheck %s
> --check-prefix=DISABLED
> +; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=gdb
> -filetype=asm < %s | FileCheck %s
> +
> +; DISABLED-NOT: {{.debug_gnu_pubnames|.debug_gnu_pubtypes}}
> +; CHECK-DAG: .section .debug_gnu_pubnames
> +; CHECK-DAG: .section .debug_gnu_pubtypes
> +
> +%struct.bar = type { %"struct.ns::foo" }
> +%"struct.ns::foo" = type { i8 }
> +
> + at b = global %struct.bar zeroinitializer, align 1, !dbg !0
> +
> +!llvm.dbg.cu
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fllvm.dbg.cu&data=02%7C01%7C%7Ce807747c01a941a740d008d588307cfa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636564664186820313&sdata=mvINKlfElV%2FOs5af4NhhZQhrn0uvO53zwdiaoqLGwPg%3D&reserved=0>
> = !{!2}
> +!llvm.module.flags = !{!11, !12}
> +!llvm.ident = !{!13}
> +
> +!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
> +!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3,
> line: 8, type: !6, isLocal: false, isDefinition: true)
> +!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file:
> !3, producer: "clang", isOptimized: false, runtimeVersion: 0,
> emissionKind: FullDebug, enums: !4, globals: !5, gnuPubnames: true)
> +!3 = !DIFile(filename: "type.cpp", directory: "/tmp/dbginfo")
> +!4 = !{}
> +!5 = !{!0}
> +!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name:
> "bar", file: !3, line: 5, size: 8, elements: !7, identifier:
> "_ZTS3bar")
> +!7 = !{!8}
> +!8 = !DIDerivedType(tag: DW_TAG_member, name: "f", scope: !6,
> file: !3, line: 6, baseType: !9, size: 8)
> +!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name:
> "foo", scope: !10, file: !3, line: 2, size: 8, elements: !4,
> identifier: "_ZTSN2ns3fooE")
> +!10 = !DINamespace(name: "ns", scope: null)
> +!11 = !{i32 2, !"Dwarf Version", i32 4}
> +!12 = !{i32 2, !"Debug Info Version", i32 3}
> +!13 = !{!"clang"}
> +
> Index: lib/CodeGen/AsmPrinter/DwarfDebug.h
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfDebug.h
> +++ lib/CodeGen/AsmPrinter/DwarfDebug.h
> @@ -258,6 +258,9 @@
> /// Use inlined strings.
> bool UseInlineStrings = false;
>
> + /// Emit GNU pub sections.
> + bool UseGnuPubSections = true;
> +
> /// DWARF5 Experimental Options
> /// @{
> bool HasDwarfAccelTables;
> @@ -501,6 +504,9 @@
> /// Returns whether to use inline strings.
> bool useInlineStrings() const { return UseInlineStrings; }
>
> + /// Returns whether GNU oub sections should be emitted.
> + bool useGnuPubSections() const { return UseGnuPubSections; }
> +
> // Experimental DWARF5 features.
>
> /// Returns whether or not to emit tables that dwarf consumers can
> Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> @@ -123,6 +123,11 @@
> clEnumVal(Disable, "Disabled")),
> cl::init(Default));
>
> +static cl::opt<bool>
> + NoDwarfGnuPubSections("no-dwarf-gnu-pub-sections", cl::Hidden,
> + cl::desc("Disable emission of GNU pub
> sections."),
> + cl::init(false));
> +
> enum LinkageNameOption {
> DefaultLinkageNames,
> AllLinkageNames,
> @@ -310,6 +315,8 @@
> // Use dwarf 4 by default if nothing is requested.
> DwarfVersion = DwarfVersion ? DwarfVersion : dwarf::DWARF_VERSION;
>
> + UseGnuPubSections = !NoDwarfGnuPubSections;
> +
> // Work around a GDB bug. GDB doesn't support the standard opcode;
> // SCE doesn't support GNU's; LLDB prefers the standard opcode,
> which
> // is defined as of DWARF 3.
> Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> @@ -846,6 +846,9 @@
> }
>
> bool DwarfCompileUnit::hasDwarfPubSections() const {
> + if (!DD->useGnuPubSections())
> + return false;
> +
> // Opting in to GNU Pubnames/types overrides the default to
> ensure these are
> // generated for things like Gold's gdb_index generation.
> if (CUNode->getGnuPubnames())
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org <mailto:llvm-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> <https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits&data=02%7C01%7C%7Ce807747c01a941a740d008d588307cfa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636564664186820313&sdata=ZxN57GAvnidN0SdqWHnarsekldPVyOFUKgvY74tzc68%3D&reserved=0>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180312/060a9046/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180312/060a9046/attachment.sig>
More information about the llvm-commits
mailing list