[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / test / CodeGen / BPF / BTF / extern-var-func-weak.ll
blob984a936553a41a9557c6b5ab3471e9d1946adad4
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
4 ; Source code:
5 ;   extern int global_func(char c) __attribute__((weak));
6 ;   int test() {
7 ;     return global_func(0);
8 ;   }
9 ; Compilation flag:
10 ;   clang -target bpf -O2 -g -S -emit-llvm test.c
12 ; Function Attrs: nounwind
13 define dso_local i32 @test() local_unnamed_addr #0 !dbg !13 {
14 entry:
15   %call = tail call i32 @global_func(i8 signext 0) #2, !dbg !16
16   ret i32 %call, !dbg !17
18 declare !dbg !4 extern_weak dso_local i32 @global_func(i8 signext) local_unnamed_addr #1
20 ; CHECK:             .section        .BTF,"",@progbits
21 ; CHECK-NEXT:        .short  60319                   # 0xeb9f
22 ; CHECK-NEXT:        .byte   1
23 ; CHECK-NEXT:        .byte   0
24 ; CHECK-NEXT:        .long   24
25 ; CHECK-NEXT:        .long   0
26 ; CHECK-NEXT:        .long   88
27 ; CHECK-NEXT:        .long   88
28 ; CHECK-NEXT:        .long   72
29 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 1)
30 ; CHECK-NEXT:        .long   218103808               # 0xd000000
31 ; CHECK-NEXT:        .long   2
32 ; CHECK-NEXT:        .long   1                       # BTF_KIND_INT(id = 2)
33 ; CHECK-NEXT:        .long   16777216                # 0x1000000
34 ; CHECK-NEXT:        .long   4
35 ; CHECK-NEXT:        .long   16777248                # 0x1000020
36 ; CHECK-NEXT:        .long   5                       # BTF_KIND_FUNC(id = 3)
37 ; CHECK-NEXT:        .long   201326593               # 0xc000001
38 ; CHECK-NEXT:        .long   1
39 ; CHECK-NEXT:        .long   0                       # BTF_KIND_FUNC_PROTO(id = 4)
40 ; CHECK-NEXT:        .long   218103809               # 0xd000001
41 ; CHECK-NEXT:        .long   2
42 ; CHECK-NEXT:        .long   0
43 ; CHECK-NEXT:        .long   5
44 ; CHECK-NEXT:        .long   55                      # BTF_KIND_INT(id = 5)
45 ; CHECK-NEXT:        .long   16777216                # 0x1000000
46 ; CHECK-NEXT:        .long   1
47 ; CHECK-NEXT:        .long   16777224                # 0x1000008
48 ; CHECK-NEXT:        .long   60                      # BTF_KIND_FUNC(id = 6)
49 ; CHECK-NEXT:        .long   201326594               # 0xc000002
50 ; CHECK-NEXT:        .long   4
51 ; CHECK-NEXT:        .byte   0                       # string offset=0
52 ; CHECK-NEXT:        .ascii  "int"                   # string offset=1
53 ; CHECK-NEXT:        .byte   0
54 ; CHECK-NEXT:        .ascii  "test"                  # string offset=5
55 ; CHECK-NEXT:        .byte   0
56 ; CHECK-NEXT:        .ascii  ".text"                 # string offset=10
57 ; CHECK-NEXT:        .byte   0
58 ; CHECK-NEXT:        .ascii  "/tmp/home/yhs/work/tests/extern/test.c" # string offset=16
59 ; CHECK-NEXT:        .byte   0
60 ; CHECK-NEXT:        .ascii  "char"                  # string offset=55
61 ; CHECK-NEXT:        .byte   0
62 ; CHECK-NEXT:        .ascii  "global_func"           # string offset=60
63 ; CHECK-NEXT:        .byte   0
65 attributes #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" }
66 attributes #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" }
67 attributes #2 = { nounwind }
69 !llvm.dbg.cu = !{!0}
70 !llvm.module.flags = !{!9, !10, !11}
71 !llvm.ident = !{!12}
73 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 71a9518c93fe1dce9611c24bc707e5baf1f39f0d)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
74 !1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/extern")
75 !2 = !{}
76 !3 = !{!4}
77 !4 = !DISubprogram(name: "global_func", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
78 !5 = !DISubroutineType(types: !6)
79 !6 = !{!7, !8}
80 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
81 !8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
82 !9 = !{i32 7, !"Dwarf Version", i32 4}
83 !10 = !{i32 2, !"Debug Info Version", i32 3}
84 !11 = !{i32 1, !"wchar_size", i32 4}
85 !12 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 71a9518c93fe1dce9611c24bc707e5baf1f39f0d)"}
86 !13 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 2, type: !14, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
87 !14 = !DISubroutineType(types: !15)
88 !15 = !{!7}
89 !16 = !DILocation(line: 3, column: 11, scope: !13)
90 !17 = !DILocation(line: 3, column: 4, scope: !13)