1 ; RUN: llc -march=bpfel -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s
2 ; RUN: llc -march=bpfeb -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s
5 ; int g __attribute__((section("ids"))) = 4;
6 ; static volatile int s = 0;
11 ; clang -target bpf -g -O2 -emit-llvm -S test.c
13 @g = dso_local local_unnamed_addr global i32 4, section "ids", align 4, !dbg !0
14 @s = internal global i32 0, align 4, !dbg !6
16 ; Function Attrs: norecurse nounwind
17 define dso_local i32 @test() local_unnamed_addr #0 !dbg !14 {
18 %1 = load i32, ptr @g, align 4, !dbg !17, !tbaa !18
19 %2 = load volatile i32, ptr @s, align 4, !dbg !22, !tbaa !18
20 %3 = add nsw i32 %2, %1, !dbg !23
24 ; CHECK-RELOC: file format elf64-bpf
25 ; CHECK-RELOC: RELOCATION RECORDS FOR [.BTF]:
26 ; CHECK-RELOC: R_BPF_64_NODYLD32 .bss
27 ; CHECK-RELOC: R_BPF_64_NODYLD32 g
28 ; CHECK-RELOC: RELOCATION RECORDS FOR [.BTF.ext]:
30 attributes #0 = { norecurse nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
33 !llvm.module.flags = !{!10, !11, !12}
36 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
37 !1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true)
38 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 9.0.0 (trunk 360739) (llvm/trunk 360747)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
39 !3 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/llvm/relocation")
42 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
43 !7 = distinct !DIGlobalVariable(name: "s", scope: !2, file: !3, line: 2, type: !8, isLocal: true, isDefinition: true)
44 !8 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !9)
45 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
46 !10 = !{i32 2, !"Dwarf Version", i32 4}
47 !11 = !{i32 2, !"Debug Info Version", i32 3}
48 !12 = !{i32 1, !"wchar_size", i32 4}
49 !13 = !{!"clang version 9.0.0 (trunk 360739) (llvm/trunk 360747)"}
50 !14 = distinct !DISubprogram(name: "test", scope: !3, file: !3, line: 3, type: !15, scopeLine: 3, isLocal: false, isDefinition: true, isOptimized: true, unit: !2, retainedNodes: !4)
51 !15 = !DISubroutineType(types: !16)
53 !17 = !DILocation(line: 4, column: 10, scope: !14)
54 !18 = !{!19, !19, i64 0}
55 !19 = !{!"int", !20, i64 0}
56 !20 = !{!"omnipotent char", !21, i64 0}
57 !21 = !{!"Simple C/C++ TBAA"}
58 !22 = !DILocation(line: 4, column: 14, scope: !14)
59 !23 = !DILocation(line: 4, column: 12, scope: !14)
60 !24 = !DILocation(line: 4, column: 3, scope: !14)