]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/bpf_base.rs
Rollup merge of #106657 - jyn514:review, r=Mark-Simulacrum
[rust.git] / compiler / rustc_target / src / spec / bpf_base.rs
1 use crate::abi::Endian;
2 use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, TargetOptions};
3
4 pub fn opts(endian: Endian) -> TargetOptions {
5     TargetOptions {
6         allow_asm: true,
7         endian,
8         linker_flavor: LinkerFlavor::Bpf,
9         atomic_cas: true,
10         dynamic_linking: true,
11         no_builtins: true,
12         panic_strategy: PanicStrategy::Abort,
13         position_independent_executables: true,
14         // Disable MergeFunctions since:
15         // - older kernels don't support bpf-to-bpf calls
16         // - on newer kernels, userspace still needs to relocate before calling
17         //   BPF_PROG_LOAD and not all BPF libraries do that yet
18         merge_functions: MergeFunctions::Disabled,
19         obj_is_bitcode: true,
20         requires_lto: false,
21         singlethread: true,
22         // When targeting the `v3` cpu in llvm, 32-bit atomics are also supported.
23         // But making this value change based on the target cpu can be mostly confusing
24         // and would require a bit of a refactor.
25         min_atomic_width: Some(64),
26         max_atomic_width: Some(64),
27         ..Default::default()
28     }
29 }