diff --git a/llvm/lib/Target/BPF/BTF.h b/llvm/lib/Target/BPF/BTF.h --- a/llvm/lib/Target/BPF/BTF.h +++ b/llvm/lib/Target/BPF/BTF.h @@ -176,6 +176,13 @@ uint32_t Type; }; +/// BTF_KIND_FUNC can be global, static or extern. +enum : uint8_t { + FUNC_STATIC = 0, + FUNC_GLOBAL = 1, + FUNC_EXTERN = 2, +}; + /// Variable scoping information. enum : uint8_t { VAR_STATIC = 0, ///< Linkage: InternalLinkage diff --git a/llvm/lib/Target/BPF/BTFDebug.h b/llvm/lib/Target/BPF/BTFDebug.h --- a/llvm/lib/Target/BPF/BTFDebug.h +++ b/llvm/lib/Target/BPF/BTFDebug.h @@ -151,7 +151,7 @@ StringRef Name; public: - BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId); + BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, uint32_t Scope); uint32_t getSize() { return BTFTypeBase::getSize(); } void completeType(BTFDebug &BDebug); void emitType(MCStreamer &OS); diff --git a/llvm/lib/Target/BPF/BTFDebug.cpp b/llvm/lib/Target/BPF/BTFDebug.cpp --- a/llvm/lib/Target/BPF/BTFDebug.cpp +++ b/llvm/lib/Target/BPF/BTFDebug.cpp @@ -308,10 +308,11 @@ } } -BTFTypeFunc::BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId) +BTFTypeFunc::BTFTypeFunc(StringRef FuncName, uint32_t ProtoTypeId, + uint32_t Scope) : Name(FuncName) { Kind = BTF::BTF_KIND_FUNC; - BTFType.Info = Kind << 24; + BTFType.Info = (Kind << 24) | Scope; BTFType.Type = ProtoTypeId; } @@ -897,8 +898,9 @@ visitSubroutineType(SP->getType(), true, FuncArgNames, ProtoTypeId); // Construct subprogram func type + uint8_t Scope = SP->isLocalToUnit() ? BTF::FUNC_STATIC : BTF::FUNC_GLOBAL; auto FuncTypeEntry = - std::make_unique(SP->getName(), ProtoTypeId); + std::make_unique(SP->getName(), ProtoTypeId, Scope); uint32_t FuncTypeId = addType(std::move(FuncTypeEntry)); for (const auto &TypeEntry : TypeEntries) @@ -1173,20 +1175,10 @@ const std::unordered_map FuncArgNames; visitSubroutineType(SP->getType(), false, FuncArgNames, ProtoTypeId); - auto VarEntry = - std::make_unique(SP->getName(), ProtoTypeId, - BTF::VAR_GLOBAL_EXTERNAL); - uint32_t VarId = addType(std::move(VarEntry)); - - StringRef SecName = F.getSection(); - if (SecName.empty()) - SecName = ".extern"; - - if (DataSecEntries.find(SecName) == DataSecEntries.end()) { - DataSecEntries[SecName] = std::make_unique(Asm, SecName); - } - - DataSecEntries[SecName]->addVar(VarId, Asm->getSymbol(&F), 8); + uint8_t Scope = BTF::FUNC_EXTERN; + auto FuncTypeEntry = + std::make_unique(SP->getName(), ProtoTypeId, Scope); + addType(std::move(FuncTypeEntry)); } } diff --git a/llvm/test/CodeGen/BPF/BTF/binary-format.ll b/llvm/test/CodeGen/BPF/BTF/binary-format.ll --- a/llvm/test/CodeGen/BPF/BTF/binary-format.ll +++ b/llvm/test/CodeGen/BPF/BTF/binary-format.ll @@ -18,12 +18,12 @@ ; CHECK-EL: 0x00000010 30000000 33000000 01000000 00000001 ; CHECK-EL: 0x00000020 04000000 20000001 00000000 0100000d ; CHECK-EL: 0x00000030 01000000 05000000 01000000 07000000 -; CHECK-EL: 0x00000040 0000000c 02000000 00696e74 00610066 +; CHECK-EL: 0x00000040 0100000c 02000000 00696e74 00610066 ; CHECK-EB: 0x00000000 eb9f0100 00000018 00000000 00000030 ; CHECK-EB: 0x00000010 00000030 00000033 00000001 01000000 ; CHECK-EB: 0x00000020 00000004 01000020 00000000 0d000001 ; CHECK-EB: 0x00000030 00000001 00000005 00000001 00000007 -; CHECK-EB: 0x00000040 0c000000 00000002 00696e74 00610066 +; CHECK-EB: 0x00000040 0c000001 00000002 00696e74 00610066 ; CHECK: 0x00000050 002e7465 7874002f 746d702f 742e6300 ; CHECK: 0x00000060 696e7420 6628696e 74206129 207b2072 ; CHECK: 0x00000070 65747572 6e20613b 207d00 diff --git a/llvm/test/CodeGen/BPF/BTF/extern-func-arg.ll b/llvm/test/CodeGen/BPF/BTF/extern-func-arg.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/BPF/BTF/extern-func-arg.ll @@ -0,0 +1,79 @@ +; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s +; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s +; +; Source code: +; extern int global_func(char arg); +; int test() { return global_func(0); } +; Compilation flag: +; clang -target bpf -O2 -g -S -emit-llvm test.c + +; Function Attrs: nounwind +define dso_local i32 @test() local_unnamed_addr #0 !dbg !13 { +entry: + %call = tail call i32 @global_func(i8 signext 0) #2, !dbg !16 + ret i32 %call, !dbg !17 +} + +; CHECK: .short 60319 # 0xeb9f +; CHECK-NEXT: .byte 1 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .long 24 +; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 72 +; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) +; CHECK-NEXT: .long 218103808 # 0xd000000 +; CHECK-NEXT: .long 2 +; CHECK-NEXT: .long 1 # BTF_KIND_INT(id = 2) +; CHECK-NEXT: .long 16777216 # 0x1000000 +; CHECK-NEXT: .long 4 +; CHECK-NEXT: .long 16777248 # 0x1000020 +; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) +; CHECK-NEXT: .long 201326593 # 0xc000001 +; CHECK-NEXT: .long 1 +; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4) +; CHECK-NEXT: .long 218103809 # 0xd000001 +; CHECK-NEXT: .long 2 +; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long 5 +; CHECK-NEXT: .long 55 # BTF_KIND_INT(id = 5) +; CHECK-NEXT: .long 16777216 # 0x1000000 +; CHECK-NEXT: .long 1 +; CHECK-NEXT: .long 16777224 # 0x1000008 +; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 6) +; CHECK-NEXT: .long 201326594 # 0xc000002 +; CHECK-NEXT: .long 4 +; CHECK: .ascii "int" # string offset=1 +; CHECK: .ascii "test" # string offset=5 +; CHECK: .ascii "char" # string offset=55 +; CHECK: .ascii "global_func" # string offset=60 + +declare !dbg !4 dso_local i32 @global_func(i8 signext) local_unnamed_addr #1 + +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" } +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" } +attributes #2 = { nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!9, !10, !11} +!llvm.ident = !{!12} + +!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) +!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/extern") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "global_func", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7, !8} +!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) +!9 = !{i32 7, !"Dwarf Version", i32 4} +!10 = !{i32 2, !"Debug Info Version", i32 3} +!11 = !{i32 1, !"wchar_size", i32 4} +!12 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 987c5665e81822b32c895fd0c97a9a084b0d3106)"} +!13 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 2, type: !14, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!14 = !DISubroutineType(types: !15) +!15 = !{!7} +!16 = !DILocation(line: 2, column: 21, scope: !13) +!17 = !DILocation(line: 2, column: 14, scope: !13) diff --git a/llvm/test/CodeGen/BPF/BTF/extern-global-var.ll b/llvm/test/CodeGen/BPF/BTF/extern-global-var.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-global-var.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-global-var.ll @@ -33,7 +33,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak-section.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak-section.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak-section.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak-section.ll @@ -23,9 +23,9 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .long 24 ; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 116 -; CHECK-NEXT: .long 116 -; CHECK-NEXT: .long 76 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 72 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) ; CHECK-NEXT: .long 218103808 # 0xd000000 ; CHECK-NEXT: .long 2 @@ -34,7 +34,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4) ; CHECK-NEXT: .long 218103809 # 0xd000001 @@ -45,16 +45,9 @@ ; CHECK-NEXT: .long 16777216 # 0x1000000 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 16777224 # 0x1000008 -; CHECK-NEXT: .long 60 # BTF_KIND_VAR(id = 6) -; CHECK-NEXT: .long 234881024 # 0xe000000 +; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 6) +; CHECK-NEXT: .long 201326594 # 0xc000002 ; CHECK-NEXT: .long 4 -; CHECK-NEXT: .long 2 -; CHECK-NEXT: .long 72 # BTF_KIND_DATASEC(id = 7) -; CHECK-NEXT: .long 251658241 # 0xf000001 -; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 6 -; CHECK-NEXT: .long global_func -; CHECK-NEXT: .long 8 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 ; CHECK-NEXT: .byte 0 @@ -68,8 +61,6 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .ascii "global_func" # string offset=60 ; CHECK-NEXT: .byte 0 -; CHECK-NEXT: .ascii "abc" # string offset=72 -; CHECK-NEXT: .byte 0 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" } 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" } diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-func-weak.ll @@ -23,9 +23,9 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .long 24 ; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 116 -; CHECK-NEXT: .long 116 -; CHECK-NEXT: .long 80 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 72 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) ; CHECK-NEXT: .long 218103808 # 0xd000000 ; CHECK-NEXT: .long 2 @@ -34,7 +34,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4) ; CHECK-NEXT: .long 218103809 # 0xd000001 @@ -45,16 +45,9 @@ ; CHECK-NEXT: .long 16777216 # 0x1000000 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 16777224 # 0x1000008 -; CHECK-NEXT: .long 60 # BTF_KIND_VAR(id = 6) -; CHECK-NEXT: .long 234881024 # 0xe000000 +; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 6) +; CHECK-NEXT: .long 201326594 # 0xc000002 ; CHECK-NEXT: .long 4 -; CHECK-NEXT: .long 2 -; CHECK-NEXT: .long 72 # BTF_KIND_DATASEC(id = 7) -; CHECK-NEXT: .long 251658241 # 0xf000001 -; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 6 -; CHECK-NEXT: .long global_func -; CHECK-NEXT: .long 8 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 ; CHECK-NEXT: .byte 0 @@ -68,8 +61,6 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .ascii "global_func" # string offset=60 ; CHECK-NEXT: .byte 0 -; CHECK-NEXT: .ascii ".extern" # string offset=72 -; CHECK-NEXT: .byte 0 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" } 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" } diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-func.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-func.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-func.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-func.ll @@ -22,9 +22,9 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .long 24 ; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 116 -; CHECK-NEXT: .long 116 -; CHECK-NEXT: .long 80 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 72 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) ; CHECK-NEXT: .long 218103808 # 0xd000000 ; CHECK-NEXT: .long 2 @@ -33,7 +33,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4) ; CHECK-NEXT: .long 218103809 # 0xd000001 @@ -44,16 +44,9 @@ ; CHECK-NEXT: .long 16777216 # 0x1000000 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 16777224 # 0x1000008 -; CHECK-NEXT: .long 60 # BTF_KIND_VAR(id = 6) -; CHECK-NEXT: .long 234881024 # 0xe000000 +; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 6) +; CHECK-NEXT: .long 201326594 # 0xc000002 ; CHECK-NEXT: .long 4 -; CHECK-NEXT: .long 2 -; CHECK-NEXT: .long 72 # BTF_KIND_DATASEC(id = 7) -; CHECK-NEXT: .long 251658241 # 0xf000001 -; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 6 -; CHECK-NEXT: .long global_func -; CHECK-NEXT: .long 8 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 ; CHECK-NEXT: .byte 0 @@ -67,8 +60,6 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .ascii "global_func" # string offset=60 ; CHECK-NEXT: .byte 0 -; CHECK-NEXT: .ascii ".extern" # string offset=72 -; CHECK-NEXT: .byte 0 declare !dbg !4 dso_local i32 @global_func(i8 signext) local_unnamed_addr #1 diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-section.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-section.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-section.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-section.ll @@ -28,8 +28,8 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .long 24 ; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 144 -; CHECK-NEXT: .long 144 +; CHECK-NEXT: .long 128 +; CHECK-NEXT: .long 128 ; CHECK-NEXT: .long 79 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) ; CHECK-NEXT: .long 218103808 # 0xd000000 @@ -39,7 +39,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 55 # BTF_KIND_INT(id = 4) ; CHECK-NEXT: .long 16777216 # 0x1000000 @@ -54,19 +54,15 @@ ; CHECK-NEXT: .long 2 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long 4 -; CHECK-NEXT: .long 63 # BTF_KIND_VAR(id = 7) -; CHECK-NEXT: .long 234881024 # 0xe000000 +; CHECK-NEXT: .long 63 # BTF_KIND_FUNC(id = 7) +; CHECK-NEXT: .long 201326594 # 0xc000002 ; CHECK-NEXT: .long 6 -; CHECK-NEXT: .long 2 ; CHECK-NEXT: .long 75 # BTF_KIND_DATASEC(id = 8) -; CHECK-NEXT: .long 251658242 # 0xf000002 +; CHECK-NEXT: .long 251658241 # 0xf000001 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long 5 ; CHECK-NEXT: .long ch ; CHECK-NEXT: .long 1 -; CHECK-NEXT: .long 7 -; CHECK-NEXT: .long global_func -; CHECK-NEXT: .long 8 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 ; CHECK-NEXT: .byte 0 diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-struct-weak.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-struct-weak.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-struct-weak.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-struct-weak.ll @@ -35,7 +35,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 55 # BTF_KIND_TYPEDEF(id = 4) ; CHECK-NEXT: .long 134217728 # 0x8000000 diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-struct.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-struct.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-struct.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-struct.ll @@ -36,7 +36,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 55 # BTF_KIND_TYPEDEF(id = 4) ; CHECK-NEXT: .long 134217728 # 0x8000000 diff --git a/llvm/test/CodeGen/BPF/BTF/extern-var-weak-section.ll b/llvm/test/CodeGen/BPF/BTF/extern-var-weak-section.ll --- a/llvm/test/CodeGen/BPF/BTF/extern-var-weak-section.ll +++ b/llvm/test/CodeGen/BPF/BTF/extern-var-weak-section.ll @@ -28,8 +28,8 @@ ; CHECK-NEXT: .byte 0 ; CHECK-NEXT: .long 24 ; CHECK-NEXT: .long 0 -; CHECK-NEXT: .long 144 -; CHECK-NEXT: .long 144 +; CHECK-NEXT: .long 128 +; CHECK-NEXT: .long 128 ; CHECK-NEXT: .long 79 ; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) ; CHECK-NEXT: .long 218103808 # 0xd000000 @@ -39,7 +39,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 55 # BTF_KIND_INT(id = 4) ; CHECK-NEXT: .long 16777216 # 0x1000000 @@ -54,19 +54,15 @@ ; CHECK-NEXT: .long 2 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long 4 -; CHECK-NEXT: .long 63 # BTF_KIND_VAR(id = 7) -; CHECK-NEXT: .long 234881024 # 0xe000000 +; CHECK-NEXT: .long 63 # BTF_KIND_FUNC(id = 7) +; CHECK-NEXT: .long 201326594 # 0xc000002 ; CHECK-NEXT: .long 6 -; CHECK-NEXT: .long 2 ; CHECK-NEXT: .long 75 # BTF_KIND_DATASEC(id = 8) -; CHECK-NEXT: .long 251658242 # 0xf000002 +; CHECK-NEXT: .long 251658241 # 0xf000001 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long 5 ; CHECK-NEXT: .long ch ; CHECK-NEXT: .long 1 -; CHECK-NEXT: .long 7 -; CHECK-NEXT: .long global_func -; CHECK-NEXT: .long 8 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 ; CHECK-NEXT: .byte 0 diff --git a/llvm/test/CodeGen/BPF/BTF/filename.ll b/llvm/test/CodeGen/BPF/BTF/filename.ll --- a/llvm/test/CodeGen/BPF/BTF/filename.ll +++ b/llvm/test/CodeGen/BPF/BTF/filename.ll @@ -28,7 +28,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll b/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll --- a/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll +++ b/llvm/test/CodeGen/BPF/BTF/func-func-ptr.ll @@ -39,7 +39,7 @@ ; CHECK-NEXT: .long 5 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 8 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 2 ; CHECK-NEXT: .long 0 # BTF_KIND_PTR(id = 4) ; CHECK-NEXT: .long 33554432 # 0x2000000 diff --git a/llvm/test/CodeGen/BPF/BTF/func-non-void.ll b/llvm/test/CodeGen/BPF/BTF/func-non-void.ll --- a/llvm/test/CodeGen/BPF/BTF/func-non-void.ll +++ b/llvm/test/CodeGen/BPF/BTF/func-non-void.ll @@ -31,7 +31,7 @@ ; CHECK-NEXT: .long 5 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 8 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 2 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/func-source.ll b/llvm/test/CodeGen/BPF/BTF/func-source.ll --- a/llvm/test/CodeGen/BPF/BTF/func-source.ll +++ b/llvm/test/CodeGen/BPF/BTF/func-source.ll @@ -28,7 +28,7 @@ ; CHECK-NEXT: .long 218103808 # 0xd000000 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long 1 # BTF_KIND_FUNC(id = 2) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .byte 102 # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/func-typedef.ll b/llvm/test/CodeGen/BPF/BTF/func-typedef.ll --- a/llvm/test/CodeGen/BPF/BTF/func-typedef.ll +++ b/llvm/test/CodeGen/BPF/BTF/func-typedef.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 16 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 18 # BTF_KIND_FUNC(id = 5) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "__int" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll b/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll --- a/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll +++ b/llvm/test/CodeGen/BPF/BTF/func-unused-arg.ll @@ -31,7 +31,7 @@ ; CHECK-NEXT: .long 5 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 8 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 2 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "int" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/func-void.ll b/llvm/test/CodeGen/BPF/BTF/func-void.ll --- a/llvm/test/CodeGen/BPF/BTF/func-void.ll +++ b/llvm/test/CodeGen/BPF/BTF/func-void.ll @@ -24,7 +24,7 @@ ; CHECK-NEXT: .long 218103808 # 0xd000000 ; CHECK-NEXT: .long 0 ; CHECK-NEXT: .long 1 # BTF_KIND_FUNC(id = 2) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "f1" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/local-var.ll b/llvm/test/CodeGen/BPF/BTF/local-var.ll --- a/llvm/test/CodeGen/BPF/BTF/local-var.ll +++ b/llvm/test/CodeGen/BPF/BTF/local-var.ll @@ -43,7 +43,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 12 # BTF_KIND_FUNC(id = 4) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 2 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "char" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/BTF/static-func.ll b/llvm/test/CodeGen/BPF/BTF/static-func.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/BPF/BTF/static-func.ll @@ -0,0 +1,96 @@ +; RUN: llc -march=bpfel -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s +; RUN: llc -march=bpfeb -filetype=asm -o - %s | FileCheck -check-prefixes=CHECK %s +; +; Source code: +; extern int foo(void); +; static __attribute__((noinline)) int test1() { return foo(); } +; int test2() { return test1(); } +; Compilation flag: +; clang -target bpf -O2 -g -S -emit-llvm test.c + +; Function Attrs: nounwind +define dso_local i32 @test2() local_unnamed_addr #0 !dbg !12 { +entry: + %call = tail call fastcc i32 @test1(), !dbg !13 + ret i32 %call, !dbg !14 +} +; Function Attrs: noinline nounwind +define internal fastcc i32 @test1() unnamed_addr #1 !dbg !15 { +entry: + %call = tail call i32 @foo() #3, !dbg !16 + ret i32 %call, !dbg !17 +} +declare !dbg !4 dso_local i32 @foo() local_unnamed_addr #2 + +; CHECK: .section .BTF,"",@progbits +; CHECK-NEXT: .short 60319 # 0xeb9f +; CHECK-NEXT: .byte 1 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .long 24 +; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 88 +; CHECK-NEXT: .long 64 +; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 1) +; CHECK-NEXT: .long 218103808 # 0xd000000 +; CHECK-NEXT: .long 2 +; CHECK-NEXT: .long 1 # BTF_KIND_INT(id = 2) +; CHECK-NEXT: .long 16777216 # 0x1000000 +; CHECK-NEXT: .long 4 +; CHECK-NEXT: .long 16777248 # 0x1000020 +; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) +; CHECK-NEXT: .long 201326593 # 0xc000001 +; CHECK-NEXT: .long 1 +; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 4) +; CHECK-NEXT: .long 218103808 # 0xd000000 +; CHECK-NEXT: .long 2 +; CHECK-NEXT: .long 54 # BTF_KIND_FUNC(id = 5) +; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 4 +; CHECK-NEXT: .long 0 # BTF_KIND_FUNC_PROTO(id = 6) +; CHECK-NEXT: .long 218103808 # 0xd000000 +; CHECK-NEXT: .long 2 +; CHECK-NEXT: .long 60 # BTF_KIND_FUNC(id = 7) +; CHECK-NEXT: .long 201326594 # 0xc000002 +; CHECK-NEXT: .long 6 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .ascii "int" # string offset=1 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .ascii "test2" # string offset=5 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .ascii ".text" # string offset=11 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .ascii "/tmp/home/yhs/work/tests/bugs/test.c" # string offset=17 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .ascii "test1" # string offset=54 +; CHECK-NEXT: .byte 0 +; CHECK-NEXT: .ascii "foo" # string offset=60 +; CHECK-NEXT: .byte 0 + +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" } +attributes #1 = { noinline 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" } +attributes #2 = { "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" } +attributes #3 = { nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!8, !9, !10} +!llvm.ident = !{!11} + +!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 000f95c4157aee07bd4ffc3f59ffdb6c7ecae4af)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None) +!1 = !DIFile(filename: "test.c", directory: "/tmp/home/yhs/work/tests/bugs") +!2 = !{} +!3 = !{!4} +!4 = !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) +!5 = !DISubroutineType(types: !6) +!6 = !{!7} +!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) +!8 = !{i32 7, !"Dwarf Version", i32 4} +!9 = !{i32 2, !"Debug Info Version", i32 3} +!10 = !{i32 1, !"wchar_size", i32 4} +!11 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 000f95c4157aee07bd4ffc3f59ffdb6c7ecae4af)"} +!12 = distinct !DISubprogram(name: "test2", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!13 = !DILocation(line: 3, column: 22, scope: !12) +!14 = !DILocation(line: 3, column: 15, scope: !12) +!15 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 2, type: !5, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) +!16 = !DILocation(line: 2, column: 55, scope: !15) +!17 = !DILocation(line: 2, column: 48, scope: !15) diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-derived-type.ll b/llvm/test/CodeGen/BPF/BTF/static-var-derived-type.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-derived-type.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-derived-type.ll @@ -51,7 +51,7 @@ ; CHECK-NEXT: .long 8 ; CHECK-NEXT: .long 16777280 # 0x1000040 ; CHECK-NEXT: .long 10 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4) ; CHECK-NEXT: .long 150994944 # 0x9000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-inited-sec.ll b/llvm/test/CodeGen/BPF/BTF/static-var-inited-sec.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-inited-sec.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-inited-sec.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4) ; CHECK-NEXT: .long 150994944 # 0x9000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-inited.ll b/llvm/test/CodeGen/BPF/BTF/static-var-inited.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-inited.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-inited.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4) ; CHECK-NEXT: .long 150994944 # 0x9000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-readonly-sec.ll b/llvm/test/CodeGen/BPF/BTF/static-var-readonly-sec.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-readonly-sec.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-readonly-sec.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_CONST(id = 4) ; CHECK-NEXT: .long 167772160 # 0xa000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-readonly.ll b/llvm/test/CodeGen/BPF/BTF/static-var-readonly.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-readonly.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-readonly.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_CONST(id = 4) ; CHECK-NEXT: .long 167772160 # 0xa000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-sec.ll b/llvm/test/CodeGen/BPF/BTF/static-var-sec.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-sec.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-sec.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4) ; CHECK-NEXT: .long 150994944 # 0x9000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var-zerolen-array.ll b/llvm/test/CodeGen/BPF/BTF/static-var-zerolen-array.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var-zerolen-array.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var-zerolen-array.ll @@ -37,7 +37,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4) ; CHECK-NEXT: .long 150994944 # 0x9000000 diff --git a/llvm/test/CodeGen/BPF/BTF/static-var.ll b/llvm/test/CodeGen/BPF/BTF/static-var.ll --- a/llvm/test/CodeGen/BPF/BTF/static-var.ll +++ b/llvm/test/CodeGen/BPF/BTF/static-var.ll @@ -40,7 +40,7 @@ ; CHECK-NEXT: .long 4 ; CHECK-NEXT: .long 16777248 # 0x1000020 ; CHECK-NEXT: .long 5 # BTF_KIND_FUNC(id = 3) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 0 # BTF_KIND_VOLATILE(id = 4) ; CHECK-NEXT: .long 150994944 # 0x9000000 diff --git a/llvm/test/CodeGen/BPF/CORE/offset-reloc-basic.ll b/llvm/test/CodeGen/BPF/CORE/offset-reloc-basic.ll --- a/llvm/test/CodeGen/BPF/CORE/offset-reloc-basic.ll +++ b/llvm/test/CodeGen/BPF/CORE/offset-reloc-basic.ll @@ -78,7 +78,7 @@ ; CHECK-NEXT: .long 30 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 34 # BTF_KIND_FUNC(id = 7) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 6 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "sk_buff" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/CORE/offset-reloc-multilevel.ll b/llvm/test/CodeGen/BPF/CORE/offset-reloc-multilevel.ll --- a/llvm/test/CodeGen/BPF/CORE/offset-reloc-multilevel.ll +++ b/llvm/test/CodeGen/BPF/CORE/offset-reloc-multilevel.ll @@ -82,7 +82,7 @@ ; CHECK-NEXT: .long 44 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 48 # BTF_KIND_FUNC(id = 6) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 5 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "sk_buff" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-anonymous.ll b/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-anonymous.ll --- a/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-anonymous.ll +++ b/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-anonymous.ll @@ -92,7 +92,7 @@ ; CHECK-NEXT: .long 53 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 57 # BTF_KIND_FUNC(id = 8) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 7 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "sk_buff" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-array.ll b/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-array.ll --- a/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-array.ll +++ b/llvm/test/CodeGen/BPF/CORE/offset-reloc-struct-array.ll @@ -93,7 +93,7 @@ ; CHECK-NEXT: .long 64 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 68 # BTF_KIND_FUNC(id = 8) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 7 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "sk_buff" # string offset=1 diff --git a/llvm/test/CodeGen/BPF/CORE/offset-reloc-union.ll b/llvm/test/CodeGen/BPF/CORE/offset-reloc-union.ll --- a/llvm/test/CodeGen/BPF/CORE/offset-reloc-union.ll +++ b/llvm/test/CodeGen/BPF/CORE/offset-reloc-union.ll @@ -96,7 +96,7 @@ ; CHECK-NEXT: .long 41 ; CHECK-NEXT: .long 1 ; CHECK-NEXT: .long 45 # BTF_KIND_FUNC(id = 7) -; CHECK-NEXT: .long 201326592 # 0xc000000 +; CHECK-NEXT: .long 201326593 # 0xc000001 ; CHECK-NEXT: .long 6 ; CHECK-NEXT: .byte 0 # string offset=0 ; CHECK-NEXT: .ascii "sk_buff" # string offset=1