61 lines · plain
1; RUN: llc -mtriple=bpfel -mcpu=v1 -filetype=obj -o %t.el < %s2; RUN: llvm-objdump -r %t.el | FileCheck --check-prefix=RELOC %s3; RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.el | FileCheck --check-prefix=DUMP %s4; RUN: llc -mtriple=bpfeb -mcpu=v1 -filetype=obj -o %t.eb < %s5; RUN: llvm-objdump -r %t.eb | FileCheck --check-prefix=RELOC %s6; RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t.eb | FileCheck --check-prefix=DUMP %s7 8; source code:9; static __attribute__((noinline)) __attribute__((section("sec1")))10; int add(int a, int b) {11; return a + b;12; }13; static __attribute__((noinline))14; int sub(int a, int b) {15; return a - b;16; }17; int test(int a, int b) {18; return add(a, b) + sub(a, b);19; }20; compilation flag:21; clang -target bpf -O2 -emit-llvm -S test.c22 23define dso_local i32 @test(i32 %a, i32 %b) local_unnamed_addr #0 {24entry:25 %call = tail call fastcc i32 @add(i32 %a, i32 %b)26 %call1 = tail call fastcc i32 @sub(i32 %a, i32 %b)27 %add = add nsw i32 %call1, %call28 ret i32 %add29}30 31define internal fastcc i32 @add(i32 %a, i32 %b) unnamed_addr #1 section "sec1" {32entry:33 %add = add nsw i32 %b, %a34 ret i32 %add35}36 37; Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn mustprogress38define internal fastcc i32 @sub(i32 %a, i32 %b) unnamed_addr #1 {39entry:40 %sub = sub nsw i32 %a, %b41 ret i32 %sub42}43 44; DUMP: .text:45; DUMP-EMPTY:46; DUMP-NEXT: <test>47; DUMP-NEXT: r[[#]] = r[[#]]48; DUMP-NEXT: r[[#]] = r[[#]]49; DUMP-NEXT: call -150 51; DUMP: sec1:52; DUMP-EMPTY:53; DUMP-NEXT: <add>54 55; RELOC: RELOCATION RECORDS FOR [.text]:56; RELOC: R_BPF_64_32 sec157; RELOC-NOT: R_BPF_64_3258 59attributes #0 = { nofree norecurse nosync nounwind readnone willreturn mustprogress "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }60attributes #1 = { nofree noinline norecurse nosync nounwind readnone willreturn mustprogress "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }61