1 ; RUN: llc < %s -mtriple=x86_64-unknown-linux | FileCheck --check-prefix=NO-ADDRSIG %s
2 ; RUN: llc < %s -mtriple=x86_64-unknown-linux -addrsig | FileCheck %s
3 ; RUN: llc %s -filetype=obj -mtriple=x86_64-unknown-linux -addrsig -o %t
4 ; RUN: llvm-readobj --addrsig %t | FileCheck %s --check-prefix=SYM
6 ; NO-ADDRSIG-NOT: .addrsig
10 ; SYM-NEXT: Sym: metadata_f2
18 ; CHECK: .addrsig_sym f1
20 %f1 = bitcast ptr @f1 to ptr
21 %f2 = bitcast ptr @f2 to ptr
22 %f3 = bitcast ptr @f3 to ptr
23 %g1 = bitcast ptr @g1 to ptr
24 %g2 = bitcast ptr @g2 to ptr
25 %g3 = bitcast ptr @g3 to ptr
26 %dllimport = bitcast ptr @dllimport to ptr
27 %tls = bitcast ptr @tls to ptr
28 %a1 = bitcast ptr @a1 to ptr
29 %a2 = bitcast ptr @a2 to ptr
30 %i1 = bitcast ptr @i1 to ptr
31 %i2 = bitcast ptr @i2 to ptr
32 call void @llvm.dbg.value(metadata ptr @metadata_f1, metadata !5, metadata !DIExpression()), !dbg !7
33 call void @llvm.dbg.value(metadata ptr @metadata_f2, metadata !5, metadata !DIExpression()), !dbg !7
34 call void @f4(ptr @metadata_f2)
38 declare void @f4(ptr) unnamed_addr
40 ;; f1 is unreferenced, so this directive would not emit an entry anyway.
41 ; CHECK-NOT: .addrsig_sym metadata_f1
42 declare void @metadata_f1()
44 ; CHECK: .addrsig_sym metadata_f2
45 declare void @metadata_f2()
47 ; CHECK-NOT: .addrsig_sym f2
48 define internal ptr @f2() local_unnamed_addr {
52 ; CHECK-NOT: .addrsig_sym f3
53 declare void @f3() unnamed_addr
55 ; CHECK: .addrsig_sym g1
57 ; CHECK-NOT: .addrsig_sym g2
58 @g2 = internal local_unnamed_addr global i32 0
59 ; CHECK-NOT: .addrsig_sym g3
60 @g3 = external unnamed_addr global i32
62 ; CHECK-NOT: .addrsig_sym unref
63 @unref = external global i32
65 ; CHECK-NOT: .addrsig_sym dllimport
66 @dllimport = external dllimport global i32
68 ; CHECK-NOT: .addrsig_sym tls
69 @tls = thread_local global i32 0
71 ; CHECK: .addrsig_sym a1
72 @a1 = alias i32, ptr @g1
73 ; CHECK-NOT: .addrsig_sym a2
74 @a2 = internal local_unnamed_addr alias i32, ptr @g2
76 ; CHECK: .addrsig_sym i1
77 @i1 = ifunc void(), ptr @f1
78 ; CHECK-NOT: .addrsig_sym i2
79 @i2 = internal local_unnamed_addr ifunc void(), ptr @f2
81 declare void @llvm.dbg.value(metadata, metadata, metadata)
84 !llvm.module.flags = !{!2}
86 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
87 !1 = !DIFile(filename: "a", directory: "")
88 !2 = !{i32 2, !"Debug Info Version", i32 3}
89 !3 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
90 !4 = !DILocation(line: 0, scope: !3)
91 !5 = !DILocalVariable(scope: !6)
92 !6 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
93 !7 = !DILocation(line: 0, scope: !6, inlinedAt: !4)