155 lines · plain
1; RUN: llc -filetype=asm %s -o - -mtriple arm64-apple-ios -addrsig | FileCheck %s2; RUN: llc -filetype=obj %s -o %t -mtriple arm64-apple-ios -addrsig3; RUN: llvm-objdump --macho --section-headers %t | FileCheck %s --check-prefix=SECTIONS4; RUN: llvm-objdump --macho --reloc %t | FileCheck %s --check-prefix=RELOCS5 6; CHECK: .section __DATA,__data7; CHECK: _i1.lazy_pointer:8; CHECK: .section __TEXT,__text,regular,pure_instructions9; CHECK: _i1:10; CHECK: _i1.stub_helper:11; CHECK: .section __DATA,__data12; CHECK: _i2.lazy_pointer:13; CHECK: .section __TEXT,__text,regular,pure_instructions14; CHECK: _i2:15; CHECK: _i2.stub_helper:16 17; CHECK: .section __DWARF18 19; CHECK: .addrsig{{$}}20; CHECK-NEXT: .addrsig_sym _func03_takeaddr21; CHECK-NEXT: .addrsig_sym _f122; CHECK-NEXT: .addrsig_sym _metadata_f223; CHECK-NEXT: .addrsig_sym _result24; CHECK-NEXT: .addrsig_sym _g125; CHECK-NEXT: .addrsig_sym _a126; CHECK-NEXT: .addrsig_sym _i127 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 sure30; addrsig's section size has been properly set during section layout. This31; catches a regression where the next section would overlap addrsig's32; 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 entries37; RELOCS: address pcrel length extern type scattered symbolnum/value38; RELOCS: 00000000 False ?( 3) True UNSIGND False _i139; RELOCS: 00000000 False ?( 3) True UNSIGND False _a140; RELOCS: 00000000 False ?( 3) True UNSIGND False _g141; RELOCS: 00000000 False ?( 3) True UNSIGND False _result42; RELOCS: 00000000 False ?( 3) True UNSIGND False _metadata_f243; RELOCS: 00000000 False ?( 3) True UNSIGND False _f144; RELOCS: 00000000 False ?( 3) True UNSIGND False _func03_takeaddr45 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 450 51; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable52define void @func01() local_unnamed_addr #0 {53entry:54 %0 = load volatile i32, ptr @result, align 455 %add = add nsw i32 %0, 156 store volatile i32 %add, ptr @result, align 457 ret void58}59 60; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable61define void @func02() local_unnamed_addr #0 {62entry:63 %0 = load volatile i32, ptr @result, align 464 %add = add nsw i32 %0, 165 store volatile i32 %add, ptr @result, align 466 ret void67}68 69; Function Attrs: minsize nofree noinline norecurse nounwind optsize ssp uwtable70define void @func03_takeaddr() #0 !dbg !9 {71entry:72 %0 = load volatile i32, ptr @result, align 473 %add = add nsw i32 %0, 174 store volatile i32 %add, ptr @result, align 475 ret void76}77 78; Function Attrs: minsize nofree norecurse nounwind optsize ssp uwtable79define 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 485 %add = add nsw i32 %0, ptrtoint (ptr @func03_takeaddr to i32)86 store volatile i32 %add, ptr @result, align 487 ret void88}89 90 91define ptr @f1() {92 %f1 = bitcast ptr @f1 to ptr93 %f2 = bitcast ptr @f2 to ptr94 %f3 = bitcast ptr @f3 to ptr95 %g1 = bitcast ptr @g1 to ptr96 %g2 = bitcast ptr @g2 to ptr97 %g3 = bitcast ptr @g3 to ptr98 %dllimport = bitcast ptr @dllimport to ptr99 %tls = bitcast ptr @tls to ptr100 %a1 = bitcast ptr @a1 to ptr101 %a2 = bitcast ptr @a2 to ptr102 %i1 = bitcast ptr @i1 to ptr103 %i2 = bitcast ptr @i2 to ptr104 call void @llvm.dbg.value(metadata ptr @metadata_f1, metadata !6, metadata !DIExpression()), !dbg !8105 call void @llvm.dbg.value(metadata ptr @metadata_f2, metadata !6, metadata !DIExpression()), !dbg !8106 call void @f4(ptr @metadata_f2)107 unreachable108}109 110declare void @f4(ptr) unnamed_addr111 112declare void @metadata_f1()113declare void @metadata_f2()114 115define internal ptr @f2() local_unnamed_addr {116 unreachable117}118 119declare void @f3() unnamed_addr120 121@g1 = global i32 0122@g2 = internal local_unnamed_addr global i32 0123@g3 = external unnamed_addr global i32124 125@unref = external global i32126 127@dllimport = external dllimport global i32128 129@tls = thread_local global i32 0130 131@a1 = alias i32, ptr @g1132@a2 = internal local_unnamed_addr alias i32, ptr @g2133 134@i1 = ifunc void(), ptr @f1135@i2 = internal local_unnamed_addr ifunc void(), ptr @f2136 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