1 ; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck %s
2 ; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck %s
5 ; struct s { int i; } __attribute__((aligned(16)));
7 ; struct s b = { 0 }; // .bss
8 ; struct s c = { 1 }; // .data
10 ; clang -target bpf -O2 -g -S -emit-llvm test.c
12 %struct.s = type { i32, [12 x i8] }
14 @a = dso_local local_unnamed_addr global %struct.s zeroinitializer, align 16, !dbg !11
15 @b = dso_local local_unnamed_addr global %struct.s { i32 0, [12 x i8] undef }, align 16, !dbg !0
16 @c = dso_local local_unnamed_addr global %struct.s { i32 1, [12 x i8] undef }, align 16, !dbg !5
19 !llvm.module.flags = !{!13, !14, !15, !16}
22 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
23 !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 3, type: !7, isLocal: false, isDefinition: true)
24 !2 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang version 16.0.0 (https://github.com/llvm/llvm-project.git 3191e8e19f1a7007ddd0e55cee60a51a058c99f5)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
25 !3 = !DIFile(filename: "test.c", directory: "/home/eddy/work/tmp", checksumkind: CSK_MD5, checksum: "b9d0621d30812c09bd3c6894f89ff5e4")
27 !5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
28 !6 = distinct !DIGlobalVariable(name: "c", scope: !2, file: !3, line: 4, type: !7, isLocal: false, isDefinition: true)
29 !7 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !3, line: 1, size: 128, align: 128, elements: !8)
31 !9 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !7, file: !3, line: 1, baseType: !10, size: 32)
32 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
33 !11 = !DIGlobalVariableExpression(var: !12, expr: !DIExpression())
34 !12 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 2, type: !7, isLocal: false, isDefinition: true)
35 !13 = !{i32 7, !"Dwarf Version", i32 5}
36 !14 = !{i32 2, !"Debug Info Version", i32 3}
37 !15 = !{i32 1, !"wchar_size", i32 4}
38 !16 = !{i32 7, !"frame-pointer", i32 2}
39 !17 = !{!"clang version 16.0.0 (https://github.com/llvm/llvm-project.git 3191e8e19f1a7007ddd0e55cee60a51a058c99f5)"}
41 ; CHECK: .section .BTF,"",@progbits
42 ; CHECK-NEXT: .short 60319 # 0xeb9f
45 ; CHECK-NEXT: .long 24
47 ; CHECK-NEXT: .long 148
48 ; CHECK-NEXT: .long 148
49 ; CHECK-NEXT: .long 26
50 ; CHECK-NEXT: .long 1 # BTF_KIND_STRUCT(id = 1)
51 ; CHECK-NEXT: .long 67108865 # 0x4000001
52 ; CHECK-NEXT: .long 16
55 ; CHECK-NEXT: .long 0 # 0x0
56 ; CHECK-NEXT: .long 5 # BTF_KIND_INT(id = 2)
57 ; CHECK-NEXT: .long 16777216 # 0x1000000
59 ; CHECK-NEXT: .long 16777248 # 0x1000020
60 ; CHECK-NEXT: .long 9 # BTF_KIND_VAR(id = 3)
61 ; CHECK-NEXT: .long 234881024 # 0xe000000
64 ; CHECK-NEXT: .long 11 # BTF_KIND_VAR(id = 4)
65 ; CHECK-NEXT: .long 234881024 # 0xe000000
68 ; CHECK-NEXT: .long 13 # BTF_KIND_VAR(id = 5)
69 ; CHECK-NEXT: .long 234881024 # 0xe000000
72 ; CHECK-NEXT: .long 15 # BTF_KIND_DATASEC(id = 6)
73 ; CHECK-NEXT: .long 251658242 # 0xf000002
77 ; CHECK-NEXT: .long 16
80 ; CHECK-NEXT: .long 16
81 ; CHECK-NEXT: .long 20 # BTF_KIND_DATASEC(id = 7)
82 ; CHECK-NEXT: .long 251658241 # 0xf000001
86 ; CHECK-NEXT: .long 16
87 ; CHECK-NEXT: .byte 0 # string offset=0
88 ; CHECK-NEXT: .byte 115 # string offset=1
90 ; CHECK-NEXT: .byte 105 # string offset=3
92 ; CHECK-NEXT: .ascii "int" # string offset=5
94 ; CHECK-NEXT: .byte 97 # string offset=9
96 ; CHECK-NEXT: .byte 98 # string offset=11
98 ; CHECK-NEXT: .byte 99 # string offset=13
100 ; CHECK-NEXT: .ascii ".bss" # string offset=15
101 ; CHECK-NEXT: .byte 0
102 ; CHECK-NEXT: .ascii ".data" # string offset=20
103 ; CHECK-NEXT: .byte 0