651e873462
Enabling CAS for BPF targets (#105708) breaks the build of core library. The failure occurs both when building rustc for BPF targets and when building crates for BPF targets with the current nightly. The LLVM BPF backend does not correctly lower all `atomicrmw` operations and crashes for unsupported ones. Before we can enable CAS for BPF in Rust, we need to fix the LLVM BPF backend first. Fixes #106795 Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
30 lines
1.1 KiB
Rust
30 lines
1.1 KiB
Rust
use crate::abi::Endian;
|
|
use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, TargetOptions};
|
|
|
|
pub fn opts(endian: Endian) -> TargetOptions {
|
|
TargetOptions {
|
|
allow_asm: true,
|
|
endian,
|
|
linker_flavor: LinkerFlavor::Bpf,
|
|
atomic_cas: false,
|
|
dynamic_linking: true,
|
|
no_builtins: true,
|
|
panic_strategy: PanicStrategy::Abort,
|
|
position_independent_executables: true,
|
|
// Disable MergeFunctions since:
|
|
// - older kernels don't support bpf-to-bpf calls
|
|
// - on newer kernels, userspace still needs to relocate before calling
|
|
// BPF_PROG_LOAD and not all BPF libraries do that yet
|
|
merge_functions: MergeFunctions::Disabled,
|
|
obj_is_bitcode: true,
|
|
requires_lto: false,
|
|
singlethread: true,
|
|
// When targeting the `v3` cpu in llvm, 32-bit atomics are also supported.
|
|
// But making this value change based on the target cpu can be mostly confusing
|
|
// and would require a bit of a refactor.
|
|
min_atomic_width: Some(64),
|
|
max_atomic_width: Some(64),
|
|
..Default::default()
|
|
}
|
|
}
|