1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

DebugInfo: Do not create a debug_macinfo section if no CUs have associated macros

Patch based on Sourabh Singh's D69839 patch.
This commit is contained in:
David Blaikie 2019-11-08 15:26:17 -08:00
parent 0c3847c076
commit 36e7b7e277
10 changed files with 31 additions and 46 deletions

View File

@ -2737,10 +2737,6 @@ void DwarfDebug::emitDebugMacinfo() {
}))
return;
// Start the dwarf macinfo section.
Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfMacinfoSection());
for (const auto &P : CUMap) {
auto &TheCU = *P.second;
if (TheCU.getCUNode()->isDebugDirectivesOnly())
@ -2750,6 +2746,8 @@ void DwarfDebug::emitDebugMacinfo() {
auto *CUNode = cast<DICompileUnit>(P.first);
DIMacroNodeArray Macros = CUNode->getMacros();
if (!Macros.empty()) {
Asm->OutStreamer->SwitchSection(
Asm->getObjFileLowering().getDwarfMacinfoSection());
Asm->OutStreamer->EmitLabel(U.getMacroLabelBegin());
handleMacroNodes(Macros, U);
Asm->OutStreamer->AddComment("End Of Macro List Mark");

View File

@ -269,9 +269,8 @@ entry:
; CHECK-NEXT: .b8 4 // DW_AT_byte_size
; CHECK-NEXT: .b8 0 // End Of Children Mark
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_macinfo
; CHECK-NEXT: {
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_loc { }
; CHECK-NOT: debug_
attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone }

View File

@ -331,7 +331,6 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
; CHECK-NEXT: .b8 4 // DW_AT_byte_size
; CHECK-NEXT: .b8 0 // End Of Children Mark
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_macinfo
; CHECK-NEXT: {
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_loc { }
; CHECK-NOT: debug_

View File

@ -86,9 +86,8 @@ bb:
; CHECK-NEXT: .b64 Lfunc_begin0 // DW_AT_low_pc
; CHECK-NEXT: .b64 Lfunc_end1 // DW_AT_high_pc
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_macinfo
; CHECK-NEXT: {
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_loc { }
; CHECK-NOT: debug_
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9}

View File

@ -8401,9 +8401,8 @@ if.end: ; preds = %if.then, %entry
; CHECK-NEXT: .b8 0 // End Of Children Mark
; CHECK-NEXT: .b8 0 // End Of Children Mark
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_macinfo
; CHECK-NEXT: {
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_loc { }
; CHECK-NOT: debug_
; Function Attrs: nounwind readnone
declare i32 @llvm.nvvm.read.ptx.sreg.ctaid.x() #1

View File

@ -470,6 +470,5 @@ attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "n
; CHECK-NEXT: .b8 4 // DW_AT_byte_size
; CHECK-NEXT: .b8 0 // End Of Children Mark
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_macinfo
; CHECK-NEXT: {
; CHECK-NEXT: }
; CHECK-NEXT: .section .debug_loc { }
; CHECK-NOT: debug_

View File

@ -5,13 +5,13 @@
; RUN: FileCheck -check-prefix=DWARF-DUMP %s
; Check that we actually have relocations, otherwise this is kind of pointless.
; READOBJ-RELOCS: Section (8) .rela.debug_info {
; READOBJ-RELOCS: Section ({{.*}}) .rela.debug_info {
; READOBJ-RELOCS: 0x1B R_RISCV_ADD32 - 0x0
; READOBJ-RELOCS-NEXT: 0x1B R_RISCV_SUB32 - 0x0
; READOBJ-RELOCS: Section (15) .rela.debug_frame {
; READOBJ-RELOCS: Section ({{.*}}) .rela.debug_frame {
; READOBJ-RELOCS: 0x20 R_RISCV_ADD32 - 0x0
; READOBJ-RELOCS-NEXT: 0x20 R_RISCV_SUB32 - 0x0
; READOBJ-RELOCS: Section (17) .rela.debug_line {
; READOBJ-RELOCS: Section ({{.*}}) .rela.debug_line {
; READOBJ-RELOCS: 0x5A R_RISCV_ADD16 - 0x0
; READOBJ-RELOCS-NEXT: 0x5A R_RISCV_SUB16 - 0x0

View File

@ -2,9 +2,8 @@
; Test that we don't pollute the start of the file with debug sections
; CHECK: .section .debug_macinfo,"",@progbits
; CHECK-NEXT: .section
; CHECK-NOT: .debug_macinfo
; CHECK-NOT: macinfo
; CHECK-NOT: macro
define void @f() !dbg !4 {
ret void, !dbg !9

View File

@ -5,7 +5,6 @@
; CHECK-NOT: .byte 0
; CHECK: .byte 0 # End Of Children Mark
; CHECK-NEXT: .Ldebug_info_end0:
; CHECK-NEXT: .section
define dso_local void @_Z2f1v() !dbg !7 {

View File

@ -71,68 +71,62 @@
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 0
; CHECK-NEXT: Offset: 511
; CHECK-NEXT: Name: .debug_macinfo
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 42
; CHECK-NEXT: Offset: 532
; CHECK-NEXT: Offset: 511
; CHECK-NEXT: Name: .debug_pubnames
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 26
; CHECK-NEXT: Offset: 596
; CHECK-NEXT: Offset: 575
; CHECK-NEXT: Name: .debug_pubtypes
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 57
; CHECK-NEXT: Offset: 644
; CHECK-NEXT: Offset: 623
; CHECK-NEXT: Name: .debug_line
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 88
; CHECK-NEXT: Offset: 719
; CHECK-NEXT: Offset: 698
; CHECK-NEXT: Name: linking
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 9
; CHECK-NEXT: Offset: 821
; CHECK-NEXT: Offset: 800
; CHECK-NEXT: Name: reloc.DATA
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 58
; CHECK-NEXT: Offset: 847
; CHECK-NEXT: Offset: 826
; CHECK-NEXT: Name: reloc..debug_info
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 6
; CHECK-NEXT: Offset: 929
; CHECK-NEXT: Offset: 908
; CHECK-NEXT: Name: reloc..debug_pubnames
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 6
; CHECK-NEXT: Offset: 963
; CHECK-NEXT: Offset: 942
; CHECK-NEXT: Name: reloc..debug_pubtypes
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 6
; CHECK-NEXT: Offset: 997
; CHECK-NEXT: Offset: 976
; CHECK-NEXT: Name: reloc..debug_line
; CHECK-NEXT: }
; CHECK-NEXT: Section {
; CHECK-NEXT: Type: CUSTOM (0x0)
; CHECK-NEXT: Size: 77
; CHECK-NEXT: Offset: 1027
; CHECK-NEXT: Offset: 1006
; CHECK-NEXT: Name: producers
; CHECK-NEXT: }
; CHECK-NEXT:]
@ -156,13 +150,13 @@
; CHECK-NEXT: 0x5B R_WASM_FUNCTION_OFFSET_I32 f2 0
; CHECK-NEXT: 0x63 R_WASM_SECTION_OFFSET_I32 .debug_str 118
; CHECK-NEXT: }
; CHECK-NEXT: Section (12) .debug_pubnames {
; CHECK-NEXT: Section (11) .debug_pubnames {
; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_info 0
; CHECK-NEXT: }
; CHECK-NEXT: Section (13) .debug_pubtypes {
; CHECK-NEXT: Section (12) .debug_pubtypes {
; CHECK-NEXT: 0x6 R_WASM_SECTION_OFFSET_I32 .debug_info 0
; CHECK-NEXT: }
; CHECK-NEXT: Section (14) .debug_line {
; CHECK-NEXT: Section (13) .debug_line {
; CHECK-NEXT: 0x2B R_WASM_FUNCTION_OFFSET_I32 f2 0
; CHECK-NEXT: }
; CHECK-NEXT:]
@ -234,7 +228,7 @@
; CHECK-NEXT: Flags [ (0x2)
; CHECK-NEXT: BINDING_LOCAL (0x2)
; CHECK-NEXT: ]
; CHECK-NEXT: ElementIndex: 0xD
; CHECK-NEXT: ElementIndex: 0xC
; CHECK-NEXT: }
; CHECK-NEXT:]