[all-commits] [llvm/llvm-project] 6bee6b: [BPF] cli option to allow libcalls (#199542)

Claire Fan via All-commits all-commits at lists.llvm.org
Thu May 28 23:11:47 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6bee6b09e21c579f191daab05a180b3ffeedfebc
      https://github.com/llvm/llvm-project/commit/6bee6b09e21c579f191daab05a180b3ffeedfebc
  Author: Claire Fan <fanyungching at gmail.com>
  Date:   2026-05-28 (Thu, 28 May 2026)

  Changed paths:
    M llvm/lib/Target/BPF/BPFISelLowering.cpp
    A llvm/test/CodeGen/BPF/libcall-non-whitelisted.ll

  Log Message:
  -----------
  [BPF] cli option to allow libcalls (#199542)

This is the follow up PR for PR #199541 

### --bpf-allows-libcalls
Second, an opt-in flag to allow additional libcalls beyond the currently
whitelisted ones.

Today BPF rejects unsupported libcalls here:

```c++
if (Sym != BPF_TRAP && Sym != "__multi3" && Sym != "__divti3" &&
    Sym != "__modti3" && Sym != "__udivti3" &&
    Sym != "__umodti3" && Sym != "memcpy" &&
    Sym != "memset" && Sym != "memmove")
  fail(
      CLI.DL, DAG,
      Twine("A call to built-in function '" + Sym +
            "' is not supported."));
```

With the new flag enabled, this error path is skipped so VM/runtime
environments can provide their own libcall implementations.

For VM runtimes using the BPF backend, libcalls are useful because they
create an interface between normal compiler-generated code and
runtime-specific optimization. We have already explored this model for
u128 arithmetic, where libcalls allow normal Rust code to stay unchanged
while the runtime can provide optimized behavior:


https://blueshift.gg/research/accelerating-u128-math-with-libcalls-and-jit-intrinsics

The same idea applies to memory operations. Users can continue writing
normal Rust like `ptr::copy_nonoverlapping`, while the runtime can
choose an implementation tailored to its execution environment.

This new option is opt-in and disabled by default, so existing kernel
projects and current BPF behavior remain unchanged.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list