1; RUN: llc -filetype=asm -O0 -mtriple=x86_64-linux-gnu < %s -dwarf-version 2 | FileCheck -check-prefixes=CHECK,ELF-ASM %s 2; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-linux-gnu -o %t-2 -dwarf-version 2 3; RUN: llvm-dwarfdump -v %t-2 | FileCheck %s -check-prefix=CHECK-DWARF 4; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-linux-gnu -o %t-4 -dwarf-version 2 5; RUN: llvm-dwarfdump -v %t-4 | FileCheck %s -check-prefix=CHECK-DWARF 6 7; RUN: llc -filetype=asm -O0 -mtriple=x86_64-apple-darwin < %s -dwarf-version 2 | FileCheck -check-prefixes=CHECK,DARWIN-ASM2 %s 8; RUN: llc -filetype=asm -O0 -mtriple=x86_64-apple-darwin < %s -dwarf-version 4 | FileCheck -check-prefixes=CHECK,DARWIN-ASM4 %s 9; RUN: llc -filetype=obj %s -mtriple=x86_64-apple-darwin -o %t2-2 -dwarf-version 2 10; RUN: llvm-dwarfdump -v %t2-2 | FileCheck %s -check-prefix=CHECK-DWARF 11; RUN: llc -filetype=obj %s -mtriple=x86_64-apple-darwin -o %t2-4 -dwarf-version 4 12; RUN: llvm-dwarfdump -v %t2-4 | FileCheck %s -check-prefix=CHECK-DWARF 13 14; RUN: llc -filetype=asm -O0 -mtriple=x86_64-pc-win32 < %s -dwarf-version 2 | FileCheck -check-prefixes=CHECK,COFF-ASM %s 15; RUN: llc -filetype=asm -O0 -mtriple=x86_64-pc-win32 < %s -dwarf-version 4 | FileCheck -check-prefixes=CHECK,COFF-ASM %s 16; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-pc-win32 -o %t3-2 -dwarf-version 2 17; RUN: llvm-dwarfdump -v %t3-2 | FileCheck %s -check-prefix=CHECK-DWARF2 18; RUN: llc -filetype=obj -O0 %s -mtriple=x86_64-pc-win32 -o %t3-4 -dwarf-version 4 19; RUN: llvm-dwarfdump -v %t3-4 | FileCheck %s -check-prefix=CHECK-DWARF 20 21; Testing case generated from: 22; clang++ tu1.cpp tu2.cpp -g -emit-llvm -c 23; llvm-link tu1.bc tu2.bc -o tu12.ll -S 24; cat hdr.h 25; struct foo { 26; }; 27; cat tu1.cpp 28; #include "hdr.h" 29; foo f; 30; cat tu2.cpp 31; #include "hdr.h" 32; foo g; 33 34; Make sure we use relocation for ref_addr on non-darwin platforms. 35; CHECK: DW_TAG_compile_unit 36; CHECK: DW_TAG_variable 37; ELF-ASM: .long [[TYPE:.*]] # DW_AT_type 38; DARWIN-ASM2: .long [[TYPE:.*]] ## DW_AT_type 39; DARWIN-ASM4: .long [[TYPE:.*]] ## DW_AT_type 40; COFF-ASM: .long [[TYPE:.*]] # DW_AT_type 41; CHECK: DW_TAG_structure_type 42; CHECK: cu_begin1 43; CHECK: DW_TAG_compile_unit 44; CHECK-NOT: DW_TAG_structure_type 45; This variable's type is in the 1st CU. 46; CHECK: DW_TAG_variable 47; Make sure this is relocatable. 48; and test that we don't create the labels to emit a correct COFF relocation 49; ELF-ASM: .quad .debug_info+[[TYPE]] # DW_AT_type 50; COFF-ASM: .secrel32 .Lsection_info+[[TYPE]] # DW_AT_type 51; DARWIN-ASM2: .quad [[TYPE]] ## DW_AT_type 52; DARWIN-ASM4: .long [[TYPE]] ## DW_AT_type 53; CHECK-NOT: DW_TAG_structure_type 54; CHECK: .section 55 56; CHECK-DWARF: DW_TAG_compile_unit 57; CHECK-DWARF: 0x[[ADDR:.*]]: DW_TAG_structure_type 58; CHECK-DWARF: DW_TAG_compile_unit 59; CHECK-DWARF: DW_TAG_variable 60; CHECK-DWARF: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[ADDR]] 61 62; CHECK-DWARF2: DW_TAG_compile_unit 63; CHECK-DWARF2: DW_TAG_variable 64; CHECK-DWARF2: DW_AT_type [DW_FORM_ref4] {{.*}} => {[[ADDR:.*]]} 65; CHECK-DWARF2: [[ADDR]]: DW_TAG_structure_type 66 67source_filename = "test/DebugInfo/X86/ref_addr_relocation.ll" 68 69%struct.foo = type { i8 } 70 71@f = global %struct.foo zeroinitializer, align 1, !dbg !0 72@g = global %struct.foo zeroinitializer, align 1, !dbg !6 73 74!llvm.dbg.cu = !{!9, !12} 75!llvm.module.flags = !{!14, !15} 76 77!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 78!1 = !DIGlobalVariable(name: "f", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true) 79!2 = !DIFile(filename: "tu1.cpp", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr") 80!3 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", file: !4, line: 1, size: 8, align: 8, elements: !5, identifier: "_ZTS3foo") 81!4 = !DIFile(filename: "./hdr.h", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr") 82!5 = !{} 83!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression()) 84!7 = !DIGlobalVariable(name: "g", scope: null, file: !8, line: 2, type: !3, isLocal: false, isDefinition: true) 85!8 = !DIFile(filename: "tu2.cpp", directory: "/Users/manmanren/test-Nov/type_unique_air/ref_addr") 86!9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.4 (trunk 191799)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !10, globals: !11, imports: !5) 87!10 = !{!3} 88!11 = !{!0} 89!12 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !8, producer: "clang version 3.4 (trunk 191799)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !10, globals: !13, imports: !5) 90!13 = !{!6} 91!14 = !{i32 2, !"Dwarf Version", i32 2} 92!15 = !{i32 1, !"Debug Info Version", i32 3} 93 94