1; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s 2; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s 3; 4; Source code: 5; extern int global_func(char arg); 6; int test() { return global_func(0); } 7; Compilation flag: 8; clang -target bpf -O2 -g -S -emit-llvm test.c 9 10; Function Attrs: nounwind 11define dso_local i32 @test() local_unnamed_addr #0 !dbg !13 { 12entry: 13 %call = tail call i32 @global_func(i8 signext 0) #2, !dbg !16 14 ret i32 %call, !dbg !17 15} 16 17; CHECK: .short 60319 # 0xeb9f 18; CHECK-NEXT: .byte 1 19; CHECK-NEXT: .byte 0 20; CHECK-NEXT: .long 24 21; CHECK-NEXT: .long 0 22; CHECK-NEXT: .long 88 23; CHECK-NEXT: .long 88 24; CHECK-NEXT: .long 72 25; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) 26; CHECK-NEXT: .long 218103808 # 0xd000000 27; CHECK-NEXT: .long 2 28; CHECK-NEXT: .long 1 # BTF_KIND_INT(id = 2) 29; CHECK-NEXT: .long 16777216 # 0x1000000 30; CHECK-NEXT: .long 4 31; CHECK-NEXT: .long 16777248 # 0x1000020 32; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) 33; CHECK-NEXT: .long 201326593 # 0xc000001 34; CHECK-NEXT: .long 1 35; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4) 36; CHECK-NEXT: .long 218103809 # 0xd000001 37; CHECK-NEXT: .long 2 38; CHECK-NEXT: .long 0 39; CHECK-NEXT: .long 5 40; CHECK-NEXT: .long 55 # BTF_KIND_INT(id = 5) 41; CHECK-NEXT: .long 16777216 # 0x1000000 42; CHECK-NEXT: .long 1 43; CHECK-NEXT: .long 16777224 # 0x1000008 44; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 6) 45; CHECK-NEXT: .long 201326594 # 0xc000002 46; CHECK-NEXT: .long 4 47; CHECK: .ascii "int" # string offset=1 48; CHECK: .ascii "test" # string offset=5 49; CHECK: .ascii "char" # string offset=55 50; CHECK: .ascii "global_func" # string offset=60 51 52declare !dbg !4 dso_local i32 @global_func(i8 signext) local_unnamed_addr #1 53 54attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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" } 55attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="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" } 56attributes #2 = { nounwind } 57 58!llvm.dbg.cu = !{!0} 59!llvm.module.flags = !{!9, !10, !11} 60!llvm.ident = !{!12} 61 62!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 987c5665e81822b32c895fd0c97a9a084b0d3106)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None) 63!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/extern") 64!2 = !{} 65!3 = !{!4} 66!4 = !DISubprogram(name: "global_func", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 67!5 = !DISubroutineType(types: !6) 68!6 = !{!7, !8} 69!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 70!8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 71!9 = !{i32 7, !"Dwarf Version", i32 4} 72!10 = !{i32 2, !"Debug Info Version", i32 3} 73!11 = !{i32 1, !"wchar_size", i32 4} 74!12 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 987c5665e81822b32c895fd0c97a9a084b0d3106)"} 75!13 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 2, type: !14, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) 76!14 = !DISubroutineType(types: !15) 77!15 = !{!7} 78!16 = !DILocation(line: 2, column: 21, scope: !13) 79!17 = !DILocation(line: 2, column: 14, scope: !13) 80