bazelbuild / platforms

Constraint values for specifying platforms and toolchains
Apache License 2.0
106 stars 70 forks source link

cpu: add ebpf #62

Closed ripatel-fd closed 1 year ago

ripatel-fd commented 1 year ago

Adds eBPF CPU architecture to platforms.

Rationale

eBPF is an instruction set that has found widespread use across the industry with working software and hardware implementations, as well as compilers and commercial variants.

I believe eBPF therefore qualifies as a ubiquitous and non-area-specific CPU constraint value.

eBPF is a virtual CPU architecture used in the Linux kernel, soon FreeBSD, Windows. Hardware implementations on FPGA exist.

A working LLVM target for eBPF exists here, with C and Rust frontends. A general-purpose programmable ISA variant (sBPF) exists here.

I'm currently working on an open-source LLVM toolchain for rules_cc and would like to use target selection as such:

llvm_toolchain(
    name = "ebpf_clang",
    llvm_repo = "llvm15",
    target_arch = "bpf",
    target_compatible_with = [
        "@platforms//os:none",
        "@platforms//cpu:ebpf",
    ],
)

(which will result in clang -target bpf-unknown-unknown -- part of mainline Clang/LLVM since at least LLVM 8.0)

Resources

Website: https://ebpf.io/ ISA spec: https://docs.kernel.org/bpf/instruction-set.html

google-cla[bot] commented 1 year ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

ripatel-fd commented 1 year ago

I'm unable to sign corporate CLA. If any individual contributor would like to reimplement this change from scratch and reopen a PR please feel free to.

ripatel-fd commented 1 year ago

Closing due to inability to sign CLA.