xref: /llvm-project/llvm/test/DebugInfo/X86/dwarf64-support.ll (revision 982b31fad2983eef08dbbddb2d58c635bdf6cf08)
1*982b31faSIgor Kudrin; This checks cases when the 64-bit DWARF debug info should not be generated
2*982b31faSIgor Kudrin; even if '-dwarf64' is specified.
3*982b31faSIgor Kudrin
4*982b31faSIgor Kudrin; The 64-bit DWARF format was introduced in DWARFv3, so the '-dwarf64' switch
5*982b31faSIgor Kudrin; should be ignored for earlier versions.
6*982b31faSIgor Kudrin; RUN: llc -mtriple=x86_64 -dwarf-version=2 -dwarf64 -filetype=obj %s -o - | \
7*982b31faSIgor Kudrin; RUN:   llvm-dwarfdump -debug-line - | \
8*982b31faSIgor Kudrin; RUN:   FileCheck %s --check-prefixes=ELF64,CHECK
9*982b31faSIgor Kudrin
10*982b31faSIgor Kudrin; DWARF64 requires 64-bit relocations, so it is not produced for 32-bit targets.
11*982b31faSIgor Kudrin; RUN: llc -mtriple=i386 -dwarf-version=5 -dwarf64 -filetype=obj %s -o - | \
12*982b31faSIgor Kudrin; RUN:   llvm-dwarfdump -debug-line - | \
13*982b31faSIgor Kudrin; RUN:   FileCheck %s --check-prefixes=ELF32,CHECK
14*982b31faSIgor Kudrin
15*982b31faSIgor Kudrin; DWARF64 is enabled only for ELF targets. The switch should be ignored for COFF.
16*982b31faSIgor Kudrin; RUN: llc -mtriple=x86_64-windows-gnu -dwarf-version=5 -dwarf64 -filetype=obj %s -o - | \
17*982b31faSIgor Kudrin; RUN:   llvm-dwarfdump -debug-line - | \
18*982b31faSIgor Kudrin; RUN:   FileCheck %s --check-prefixes=COFF,CHECK
19*982b31faSIgor Kudrin
20*982b31faSIgor Kudrin; DWARF64 is enabled only for ELF targets. The switch should be ignored for Mach-O.
21*982b31faSIgor Kudrin; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -dwarf64 -filetype=obj %s -o - | \
22*982b31faSIgor Kudrin; RUN:   llvm-dwarfdump -debug-line - | \
23*982b31faSIgor Kudrin; RUN:   FileCheck %s --check-prefixes=MACHO,CHECK
24*982b31faSIgor Kudrin
25*982b31faSIgor Kudrin; ELF64:    file format elf64-x86-64
26*982b31faSIgor Kudrin; ELF32:    file format elf32-i386
27*982b31faSIgor Kudrin; COFF:     file format COFF-x86-64
28*982b31faSIgor Kudrin; MACHO:    file format Mach-O 64-bit x86-64
29*982b31faSIgor Kudrin
30*982b31faSIgor Kudrin; CHECK:      .debug_line contents:
31*982b31faSIgor Kudrin; CHECK-NEXT: debug_line[0x00000000]
32*982b31faSIgor Kudrin; CHECK-NEXT: Line table prologue:
33*982b31faSIgor Kudrin; CHECK-NEXT:     total_length:
34*982b31faSIgor Kudrin; CHECK-NEXT:         format: DWARF32
35*982b31faSIgor Kudrin
36*982b31faSIgor Kudrin; IR generated and reduced from:
37*982b31faSIgor Kudrin; $ cat foo.c
38*982b31faSIgor Kudrin; int foo;
39*982b31faSIgor Kudrin; $ clang -g -S -emit-llvm foo.c -o foo.ll
40*982b31faSIgor Kudrin
41*982b31faSIgor Kudrintarget triple = "x86_64-unknown-linux-gnu"
42*982b31faSIgor Kudrin
43*982b31faSIgor Kudrin@foo = dso_local global i32 0, align 4, !dbg !0
44*982b31faSIgor Kudrin
45*982b31faSIgor Kudrin!llvm.dbg.cu = !{!2}
46*982b31faSIgor Kudrin!llvm.module.flags = !{!7, !8, !9}
47*982b31faSIgor Kudrin!llvm.ident = !{!10}
48*982b31faSIgor Kudrin
49*982b31faSIgor Kudrin!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
50*982b31faSIgor Kudrin!1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
51*982b31faSIgor Kudrin!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
52*982b31faSIgor Kudrin!3 = !DIFile(filename: "foo.c", directory: "/tmp")
53*982b31faSIgor Kudrin!4 = !{}
54*982b31faSIgor Kudrin!5 = !{!0}
55*982b31faSIgor Kudrin!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
56*982b31faSIgor Kudrin!7 = !{i32 7, !"Dwarf Version", i32 4}
57*982b31faSIgor Kudrin!8 = !{i32 2, !"Debug Info Version", i32 3}
58*982b31faSIgor Kudrin!9 = !{i32 1, !"wchar_size", i32 4}
59*982b31faSIgor Kudrin!10 = !{!"clang version 12.0.0"}
60