1 ; REQUIRES: bpf-registered-target
3 ;; Verify that llvm-objdump can use .BTF.ext to show CO-RE relocation data.
5 ; RUN: llc --mtriple bpfel %s --filetype=obj -o - | \
6 ; RUN: llvm-objdump --no-addresses --no-show-raw-insn -dr - | \
9 ; RUN: llc --mtriple bpfeb %s --filetype=obj -o - | \
10 ; RUN: llvm-objdump --no-addresses --no-show-raw-insn -dr - | \
13 ;; Input generated from the following C code:
15 ;; #define __pai __attribute__((preserve_access_index))
18 ;; volatile unsigned long g;
20 ;; g = __builtin_preserve_enum_value(*(enum bar *)U, 0);
21 ;; g = __builtin_preserve_enum_value(*(enum bar *)V, 1);
24 ;; Using the following command:
26 ;; clang --target=bpf -g -O2 -emit-llvm -S t.c
28 ; CHECK: CO-RE <enumval_exists> [[[#]]] enum bar::U = 0
29 ; CHECK: CO-RE <enumval_value> [[[#]]] enum bar::V = 1
31 @g = dso_local global i64 0, align 8, !dbg !0
32 @"llvm.bar:11:1$1" = external global i64, !llvm.preserve.access.index !5 #0
33 @"llvm.bar:10:1$0" = external global i64, !llvm.preserve.access.index !5 #0
35 ; Function Attrs: nofree nounwind memory(readwrite, argmem: none)
36 define dso_local void @root() local_unnamed_addr #1 !dbg !18 {
38 %0 = load i64, ptr @"llvm.bar:10:1$0", align 8
39 %1 = tail call i64 @llvm.bpf.passthrough.i64.i64(i32 1, i64 %0)
40 store volatile i64 %1, ptr @g, align 8, !dbg !22, !tbaa !23
41 %2 = load i64, ptr @"llvm.bar:11:1$1", align 8
42 %3 = tail call i64 @llvm.bpf.passthrough.i64.i64(i32 0, i64 %2)
43 store volatile i64 %3, ptr @g, align 8, !dbg !27, !tbaa !23
47 ; Function Attrs: nofree nosync nounwind memory(none)
48 declare i64 @llvm.bpf.passthrough.i64.i64(i32, i64) #2
50 attributes #0 = { "btf_ama" }
51 attributes #1 = { nofree nounwind memory(readwrite, argmem: none) "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
52 attributes #2 = { nofree nosync nounwind memory(none) }
55 !llvm.module.flags = !{!13, !14, !15, !16}
58 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
59 !1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 4, type: !11, isLocal: false, isDefinition: true)
60 !2 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang version 17.0.0 (/home/eddy/work/llvm-project/clang 2f8c5c0afd1d79a771dd74c8fb1e5bbae6d04eb7)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !10, splitDebugInlining: false, nameTableKind: None)
61 !3 = !DIFile(filename: "t.c", directory: "/home/eddy/work/tmp", checksumkind: CSK_MD5, checksum: "5423aa9ef48cb61e948b5c2bd75fd1df")
63 !5 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "bar", file: !3, line: 3, baseType: !6, size: 32, elements: !7)
64 !6 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
66 !8 = !DIEnumerator(name: "U", value: 0)
67 !9 = !DIEnumerator(name: "V", value: 1)
69 !11 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !12)
70 !12 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)
71 !13 = !{i32 7, !"Dwarf Version", i32 5}
72 !14 = !{i32 2, !"Debug Info Version", i32 3}
73 !15 = !{i32 1, !"wchar_size", i32 4}
74 !16 = !{i32 7, !"frame-pointer", i32 2}
75 !17 = !{!"clang version 17.0.0 (/home/eddy/work/llvm-project/clang 2f8c5c0afd1d79a771dd74c8fb1e5bbae6d04eb7)"}
76 !18 = distinct !DISubprogram(name: "root", scope: !3, file: !3, line: 5, type: !19, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !21)
77 !19 = !DISubroutineType(types: !20)
80 !22 = !DILocation(line: 6, column: 5, scope: !18)
81 !23 = !{!24, !24, i64 0}
82 !24 = !{!"long", !25, i64 0}
83 !25 = !{!"omnipotent char", !26, i64 0}
84 !26 = !{!"Simple C/C++ TBAA"}
85 !27 = !DILocation(line: 7, column: 5, scope: !18)
86 !28 = !DILocation(line: 8, column: 1, scope: !18)