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; void f(void) { } 6; Compilation flag: 7; clang -target bpf -O2 -g -gdwarf-5 -gembed-source -S -emit-llvm t.c 8; 9; This test embeds the source code in the IR, so the line info should have 10; correct reference to the lines in the string table. 11 12; Function Attrs: norecurse nounwind readnone 13define dso_local void @f() local_unnamed_addr #0 !dbg !7 { 14entry: 15 ret void, !dbg !10 16} 17 18; CHECK: .section .BTF,"",@progbits 19; CHECK-NEXT: .short 60319 # 0xeb9f 20; CHECK-NEXT: .byte 1 21; CHECK-NEXT: .byte 0 22; CHECK-NEXT: .long 24 23; CHECK-NEXT: .long 0 24; CHECK-NEXT: .long 24 25; CHECK-NEXT: .long 24 26; CHECK-NEXT: .long 35 27; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) 28; CHECK-NEXT: .long 218103808 # 0xd000000 29; CHECK-NEXT: .long 0 30; CHECK-NEXT: .long 1 # BTF_KIND_FUNC(id = 2) 31; CHECK-NEXT: .long 201326593 # 0xc000001 32; CHECK-NEXT: .long 1 33; CHECK-NEXT: .byte 0 # string offset=0 34; CHECK-NEXT: .byte 102 # string offset=1 35; CHECK-NEXT: .byte 0 36; CHECK-NEXT: .ascii ".text" # string offset=3 37; CHECK-NEXT: .byte 0 38; CHECK-NEXT: .ascii "/tmp/t.c" # string offset=9 39; CHECK-NEXT: .byte 0 40; CHECK-NEXT: .ascii "void f(void) { }" # string offset=18 41; CHECK-NEXT: .byte 0 42; CHECK-NEXT: .section .BTF.ext,"",@progbits 43; CHECK-NEXT: .short 60319 # 0xeb9f 44; CHECK-NEXT: .byte 1 45; CHECK-NEXT: .byte 0 46; CHECK-NEXT: .long 32 47; CHECK-NEXT: .long 0 48; CHECK-NEXT: .long 20 49; CHECK-NEXT: .long 20 50; CHECK-NEXT: .long 28 51; CHECK-NEXT: .long 48 52; CHECK-NEXT: .long 0 53; CHECK-NEXT: .long 8 # FuncInfo 54; CHECK-NEXT: .long 3 # FuncInfo section string offset=3 55; CHECK-NEXT: .long 1 56; CHECK-NEXT: .long .Lfunc_begin0 57; CHECK-NEXT: .long 2 58; CHECK-NEXT: .long 16 # LineInfo 59; CHECK-NEXT: .long 3 # LineInfo section string offset=3 60; CHECK-NEXT: .long 1 61; CHECK-NEXT: .long .Ltmp{{[0-9]+}} 62; CHECK-NEXT: .long 9 63; CHECK-NEXT: .long 18 64; CHECK-NEXT: .long 1040 # Line 1 Col 16 65 66attributes #0 = { norecurse nounwind readnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "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" } 67 68!llvm.dbg.cu = !{!0} 69!llvm.module.flags = !{!3, !4, !5} 70!llvm.ident = !{!6} 71 72!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0 (trunk 344789) (llvm/trunk 344782)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) 73!1 = !DIFile(filename: "t.c", directory: "/tmp", checksumkind: CSK_MD5, checksum: "978599fafe3a080b456e3d95a3710359", source: "void f(void) { }\0A") 74!2 = !{} 75!3 = !{i32 2, !"Dwarf Version", i32 5} 76!4 = !{i32 2, !"Debug Info Version", i32 3} 77!5 = !{i32 1, !"wchar_size", i32 4} 78!6 = !{!"clang version 8.0.0 (trunk 344789) (llvm/trunk 344782)"} 79!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, isOptimized: true, unit: !0, retainedNodes: !2) 80!8 = !DISubroutineType(types: !9) 81!9 = !{null} 82!10 = !DILocation(line: 1, column: 16, scope: !7) 83