2020-11-30 19:41:57 +00:00
|
|
|
use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, TargetOptions};
|
|
|
|
|
use crate::{abi::Endian, spec::abi::Abi};
|
|
|
|
|
|
|
|
|
|
pub fn opts(endian: Endian) -> TargetOptions {
|
|
|
|
|
TargetOptions {
|
2021-04-20 19:03:10 +10:00
|
|
|
allow_asm: true,
|
2020-11-30 19:41:57 +00:00
|
|
|
endian,
|
|
|
|
|
linker_flavor: LinkerFlavor::BpfLinker,
|
|
|
|
|
atomic_cas: false,
|
|
|
|
|
executables: true,
|
|
|
|
|
dynamic_linking: true,
|
|
|
|
|
no_builtins: true,
|
|
|
|
|
panic_strategy: PanicStrategy::Abort,
|
|
|
|
|
position_independent_executables: true,
|
2021-05-29 22:21:23 +10:00
|
|
|
// 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
|
2020-11-30 19:41:57 +00:00
|
|
|
merge_functions: MergeFunctions::Disabled,
|
|
|
|
|
obj_is_bitcode: true,
|
|
|
|
|
requires_lto: false,
|
|
|
|
|
singlethread: true,
|
|
|
|
|
max_atomic_width: Some(64),
|
|
|
|
|
unsupported_abis: vec![
|
|
|
|
|
Abi::Cdecl,
|
|
|
|
|
Abi::Stdcall { unwind: false },
|
|
|
|
|
Abi::Stdcall { unwind: true },
|
|
|
|
|
Abi::Fastcall,
|
|
|
|
|
Abi::Vectorcall,
|
|
|
|
|
Abi::Thiscall { unwind: false },
|
|
|
|
|
Abi::Thiscall { unwind: true },
|
|
|
|
|
Abi::Aapcs,
|
|
|
|
|
Abi::Win64,
|
|
|
|
|
Abi::SysV64,
|
|
|
|
|
Abi::PtxKernel,
|
|
|
|
|
Abi::Msp430Interrupt,
|
|
|
|
|
Abi::X86Interrupt,
|
|
|
|
|
Abi::AmdGpuKernel,
|
|
|
|
|
],
|
|
|
|
|
..Default::default()
|
|
|
|
|
}
|
|
|
|
|
}
|