[llvm] BPF: Ensure __sync_fetch_and_add() always generate atomic_fetch_add insn (PR #101428)
Bryce Kahle via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 11:48:17 PDT 2024
brycekahle wrote:
@yonghong-song we cannot use `clang -target bpf` because we have non-CO-RE kernel tracing. From https://www.kernel.org/doc/html/v5.17/bpf/bpf_devel_QA.html#q-clang-flag-for-target-bpf
> Q: In some cases clang flag -target bpf is used but in other cases the default clang target, which matches the underlying architecture, is used. What is the difference and when I should use which?
> A: Although LLVM IR generation and optimization try to stay architecture independent, -target <arch> still has some impact on generated code:
> BPF program may recursively include header file(s) with file scope inline assembly codes. The default target can handle this well, while bpf target may fail if bpf backend assembler does not understand these assembly codes, which is true in most cases.
https://github.com/llvm/llvm-project/pull/101428
More information about the llvm-commits
mailing list