1; RUN: llc -filetype=asm %s -o - -mtriple arm64-apple-ios -addrsig | FileCheck %s 2; RUN: llc -filetype=obj %s -o %t -mtriple arm64-apple-ios -addrsig 3; RUN: llvm-objdump --macho --section-headers %t | FileCheck %s --check-prefix=SECTIONS 4; RUN: llvm-objdump --macho --reloc %t | FileCheck %s --check-prefix=RELOCS 5 6; CHECK: .section __DATA,__data 7; CHECK: _i1.lazy_pointer: 8; CHECK: .section __TEXT,__text,regular,pure_instructions 9; CHECK: _i1: 10; CHECK: _i1.stub_helper: 11; CHECK: .section __DATA,__data 12; CHECK: _i2.lazy_pointer: 13; CHECK: .section __TEXT,__text,regular,pure_instructions 14; CHECK: _i2: 15; CHECK: _i2.stub_helper: 16 17; CHECK: .section __DWARF 18 19; CHECK: .addrsig{{$}} 20; CHECK-NEXT: .addrsig_sym _func03_takeaddr 21; CHECK-NEXT: .addrsig_sym _f1 22; CHECK-NEXT: .addrsig_sym _metadata_f2 23; CHECK-NEXT: .addrsig_sym _result 24; CHECK-NEXT: .addrsig_sym _g1 25; CHECK-NEXT: .addrsig_sym _a1 26; CHECK-NEXT: .addrsig_sym _i1 27 28; The __debug_line section (which should be generated for the given input file) 29; should appear immediately after the addrsig section. Use it to make sure 30; addrsig's section size has been properly set during section layout. This 31; catches a regression where the next section would overlap addrsig's 32; contents. 33; SECTIONS: __llvm_addrsig 00000008 [[#%.16x,ADDR:]] 34; SECTIONS-NEXT: __debug_line {{[[:xdigit:]]+}} [[#%.16x,8+ADDR]] 35 36; RELOCS: Relocation information (__DATA,__llvm_addrsig) 7 entries 37; RELOCS: address pcrel length extern type scattered symbolnum/value 38; RELOCS: 00000000 False ?( 3) True UNSIGND False _i1 39; RELOCS: 00000000 False ?( 3) True UNSIGND False _a1 40; RELOCS: 00000000 False ?( 3) True UNSIGND False _g1 41; RELOCS: 00000000 False ?( 3) True UNSIGND False _result 42; RELOCS: 00000000 False ?( 3) True UNSIGND False _metadata_f2 43; RELOCS: 00000000 False ?( 3) True UNSIGND False _f1 44; RELOCS: 00000000 False ?( 3) True UNSIGND False _func03_takeaddr 45 46target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 47target triple = "arm64-apple-ios7.0.0" 48 49@result = global i32 0, align 4 50 51; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable 52define void @func01() local_unnamed_addr #0 { 53entry: 54 %0 = load volatile i32, ptr @result, align 4 55 %add = add nsw i32 %0, 1 56 store volatile i32 %add, ptr @result, align 4 57 ret void 58} 59 60; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable 61define void @func02() local_unnamed_addr #0 { 62entry: 63 %0 = load volatile i32, ptr @result, align 4 64 %add = add nsw i32 %0, 1 65 store volatile i32 %add, ptr @result, align 4 66 ret void 67} 68 69; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable 70define void @func03_takeaddr() #0 !dbg !9 { 71entry: 72 %0 = load volatile i32, ptr @result, align 4 73 %add = add nsw i32 %0, 1 74 store volatile i32 %add, ptr @result, align 4 75 ret void 76} 77 78; Function Attrs: minsize nofree norecurse nounwind optsize ssp uwtable 79define void @callAllFunctions() local_unnamed_addr { 80entry: 81 tail call void @func01() 82 tail call void @func02() 83 tail call void @func03_takeaddr() 84 %0 = load volatile i32, ptr @result, align 4 85 %add = add nsw i32 %0, ptrtoint (ptr @func03_takeaddr to i32) 86 store volatile i32 %add, ptr @result, align 4 87 ret void 88} 89 90 91define ptr @f1() { 92 %f1 = bitcast ptr @f1 to ptr 93 %f2 = bitcast ptr @f2 to ptr 94 %f3 = bitcast ptr @f3 to ptr 95 %g1 = bitcast ptr @g1 to ptr 96 %g2 = bitcast ptr @g2 to ptr 97 %g3 = bitcast ptr @g3 to ptr 98 %dllimport = bitcast ptr @dllimport to ptr 99 %tls = bitcast ptr @tls to ptr 100 %a1 = bitcast ptr @a1 to ptr 101 %a2 = bitcast ptr @a2 to ptr 102 %i1 = bitcast ptr @i1 to ptr 103 %i2 = bitcast ptr @i2 to ptr 104 call void @llvm.dbg.value(metadata ptr @metadata_f1, metadata !6, metadata !DIExpression()), !dbg !8 105 call void @llvm.dbg.value(metadata ptr @metadata_f2, metadata !6, metadata !DIExpression()), !dbg !8 106 call void @f4(ptr @metadata_f2) 107 unreachable 108} 109 110declare void @f4(ptr) unnamed_addr 111 112declare void @metadata_f1() 113declare void @metadata_f2() 114 115define internal ptr @f2() local_unnamed_addr { 116 unreachable 117} 118 119declare void @f3() unnamed_addr 120 121@g1 = global i32 0 122@g2 = internal local_unnamed_addr global i32 0 123@g3 = external unnamed_addr global i32 124 125@unref = external global i32 126 127@dllimport = external dllimport global i32 128 129@tls = thread_local global i32 0 130 131@a1 = alias i32, ptr @g1 132@a2 = internal local_unnamed_addr alias i32, ptr @g2 133 134@i1 = ifunc void(), ptr @f1 135@i2 = internal local_unnamed_addr ifunc void(), ptr @f2 136 137declare void @llvm.dbg.value(metadata, metadata, metadata) 138 139attributes #0 = { noinline } 140!llvm.dbg.cu = !{!0} 141!llvm.module.flags = !{!2, !3} 142 143!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug) 144!1 = !DIFile(filename: "test.c", directory: "/tmp") 145!2 = !{i32 7, !"Dwarf Version", i32 4} 146!3 = !{i32 2, !"Debug Info Version", i32 3} 147 148!4 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0) 149!5 = !DILocation(line: 0, scope: !4) 150!6 = !DILocalVariable(scope: !7) 151!7 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0) 152!8 = !DILocation(line: 0, scope: !7, inlinedAt: !5) 153!9 = distinct !DISubprogram(scope: null, file: !1, line: 1, type: !10, unit: !0) 154!10 = !DISubroutineType(types: !{}) 155