1
Fork 0

Rollup merge of #134932 - RalfJung:arm-float-abi, r=workingjubilee

explicitly set float ABI for all ARM targets

We currently always set the `FloatABIType` field in the LLVM target machine to `Default`, which means LLVM infers the ARM float ABI (hard vs soft) from the LLVM target triple. This causes problems such as having to set the LLVM triple to `*-gnueabi` for our `musleabi` targets to ensure they get correctly inferred as soft-float targets. It also means rustc doesn't really know which float ABI ends up being used, which is a blocker for https://github.com/rust-lang/rust/pull/134794. So I think we should stop doing that and instead explicitly control that value. That's what this PR implements.

See [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fwg-llvm/topic/Softfloat.20ABI.2C.20hardfloat.20instructions) for more context.

Best reviewed commit-by-commit. I hope I got all those `llvm_floatabi` values right...
This commit is contained in:
Stuart Cook 2024-12-31 14:12:47 +11:00 committed by GitHub
commit e49929e44d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 258 additions and 103 deletions

View file

@ -25,7 +25,7 @@ impl OwnedTargetMachine {
model: llvm::CodeModel,
reloc: llvm::RelocModel,
level: llvm::CodeGenOptLevel,
use_soft_fp: bool,
float_abi: llvm::FloatAbi,
function_sections: bool,
data_sections: bool,
unique_section_names: bool,
@ -57,7 +57,7 @@ impl OwnedTargetMachine {
model,
reloc,
level,
use_soft_fp,
float_abi,
function_sections,
data_sections,
unique_section_names,

View file

@ -26,7 +26,7 @@ use rustc_session::config::{
self, Lto, OutputType, Passes, RemapPathScopeComponents, SplitDwarfKind, SwitchWithOptPath,
};
use rustc_span::{BytePos, InnerSpan, Pos, SpanData, SyntaxContext, sym};
use rustc_target::spec::{CodeModel, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel};
use rustc_target::spec::{CodeModel, FloatAbi, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel};
use tracing::debug;
use crate::back::lto::ThinBuffer;
@ -181,6 +181,14 @@ pub(crate) fn to_llvm_code_model(code_model: Option<CodeModel>) -> llvm::CodeMod
}
}
fn to_llvm_float_abi(float_abi: Option<FloatAbi>) -> llvm::FloatAbi {
match float_abi {
None => llvm::FloatAbi::Default,
Some(FloatAbi::Soft) => llvm::FloatAbi::Soft,
Some(FloatAbi::Hard) => llvm::FloatAbi::Hard,
}
}
pub(crate) fn target_machine_factory(
sess: &Session,
optlvl: config::OptLevel,
@ -189,12 +197,12 @@ pub(crate) fn target_machine_factory(
let reloc_model = to_llvm_relocation_model(sess.relocation_model());
let (opt_level, _) = to_llvm_opt_settings(optlvl);
let use_softfp = if sess.target.arch == "arm" {
sess.opts.cg.soft_float
let float_abi = if sess.target.arch == "arm" && sess.opts.cg.soft_float {
llvm::FloatAbi::Soft
} else {
// `validate_commandline_args_with_session_available` has already warned about this being
// ignored. Let's make sure LLVM doesn't suddenly start using this flag on more targets.
false
to_llvm_float_abi(sess.target.llvm_floatabi)
};
let ffunction_sections =
@ -290,7 +298,7 @@ pub(crate) fn target_machine_factory(
code_model,
reloc_model,
opt_level,
use_softfp,
float_abi,
ffunction_sections,
fdata_sections,
funique_section_names,

View file

@ -526,7 +526,7 @@ pub struct SanitizerOptions {
pub sanitize_kernel_address_recover: bool,
}
/// LLVMRelocMode
/// LLVMRustRelocModel
#[derive(Copy, Clone, PartialEq)]
#[repr(C)]
pub enum RelocModel {
@ -538,6 +538,15 @@ pub enum RelocModel {
ROPI_RWPI,
}
/// LLVMRustFloatABI
#[derive(Copy, Clone, PartialEq)]
#[repr(C)]
pub enum FloatAbi {
Default,
Soft,
Hard,
}
/// LLVMRustCodeModel
#[derive(Copy, Clone)]
#[repr(C)]
@ -2192,7 +2201,7 @@ unsafe extern "C" {
Model: CodeModel,
Reloc: RelocModel,
Level: CodeGenOptLevel,
UseSoftFP: bool,
FloatABIType: FloatAbi,
FunctionSections: bool,
DataSections: bool,
UniqueSectionNames: bool,

View file

@ -308,6 +308,24 @@ static Reloc::Model fromRust(LLVMRustRelocModel RustReloc) {
report_fatal_error("Bad RelocModel.");
}
enum class LLVMRustFloatABI {
Default,
Soft,
Hard,
};
static FloatABI::ABIType fromRust(LLVMRustFloatABI RustFloatAbi) {
switch (RustFloatAbi) {
case LLVMRustFloatABI::Default:
return FloatABI::Default;
case LLVMRustFloatABI::Soft:
return FloatABI::Soft;
case LLVMRustFloatABI::Hard:
return FloatABI::Hard;
}
report_fatal_error("Bad FloatABI.");
}
/// getLongestEntryLength - Return the length of the longest entry in the table.
template <typename KV> static size_t getLongestEntryLength(ArrayRef<KV> Table) {
size_t MaxLen = 0;
@ -358,7 +376,7 @@ extern "C" const char *LLVMRustGetHostCPUName(size_t *OutLen) {
extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
const char *TripleStr, const char *CPU, const char *Feature,
const char *ABIStr, LLVMRustCodeModel RustCM, LLVMRustRelocModel RustReloc,
LLVMRustCodeGenOptLevel RustOptLevel, bool UseSoftFloat,
LLVMRustCodeGenOptLevel RustOptLevel, LLVMRustFloatABI RustFloatABIType,
bool FunctionSections, bool DataSections, bool UniqueSectionNames,
bool TrapUnreachable, bool Singlethread, bool VerboseAsm,
bool EmitStackSizeSection, bool RelaxELFRelocations, bool UseInitArray,
@ -369,6 +387,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
auto OptLevel = fromRust(RustOptLevel);
auto RM = fromRust(RustReloc);
auto CM = fromRust(RustCM);
auto FloatABIType = fromRust(RustFloatABIType);
std::string Error;
auto Trip = Triple(Triple::normalize(TripleStr));
@ -381,10 +400,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
TargetOptions Options = codegen::InitTargetOptionsFromCodeGenFlags(Trip);
Options.FloatABIType = FloatABI::Default;
if (UseSoftFloat) {
Options.FloatABIType = FloatABI::Soft;
}
Options.FloatABIType = FloatABIType;
Options.DataSections = DataSections;
Options.FunctionSections = FunctionSections;
Options.UniqueSectionNames = UniqueSectionNames;

View file

@ -2,8 +2,8 @@ use std::borrow::Cow;
use std::env;
use crate::spec::{
Cc, DebuginfoKind, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, StaticCow,
TargetOptions, cvs,
Cc, DebuginfoKind, FloatAbi, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType,
StaticCow, TargetOptions, cvs,
};
#[cfg(test)]
@ -105,6 +105,7 @@ pub(crate) fn base(
) -> (TargetOptions, StaticCow<str>, StaticCow<str>) {
let opts = TargetOptions {
abi: abi.target_abi().into(),
llvm_floatabi: Some(FloatAbi::Hard),
os: os.into(),
cpu: arch.target_cpu(abi).into(),
link_env_remove: link_env_remove(os),

View file

@ -116,6 +116,18 @@ impl Target {
Some(Ok(()))
})).unwrap_or(Ok(()))
} );
($key_name:ident, FloatAbi) => ( {
let name = (stringify!($key_name)).replace("_", "-");
obj.remove(&name).and_then(|o| o.as_str().and_then(|s| {
match s.parse::<super::FloatAbi>() {
Ok(float_abi) => base.$key_name = Some(float_abi),
_ => return Some(Err(format!("'{}' is not a valid value for \
llvm-floatabi. Use 'soft' or 'hard'.",
s))),
}
Some(Ok(()))
})).unwrap_or(Ok(()))
} );
($key_name:ident, RelocModel) => ( {
let name = (stringify!($key_name)).replace("_", "-");
obj.remove(&name).and_then(|o| o.as_str().and_then(|s| {
@ -598,6 +610,7 @@ impl Target {
key!(mcount = "target-mcount");
key!(llvm_mcount_intrinsic, optional);
key!(llvm_abiname);
key!(llvm_floatabi, FloatAbi)?;
key!(relax_elf_relocations, bool);
key!(llvm_args, list);
key!(use_ctors_section, bool);
@ -772,6 +785,7 @@ impl ToJson for Target {
target_option_val!(mcount, "target-mcount");
target_option_val!(llvm_mcount_intrinsic);
target_option_val!(llvm_abiname);
target_option_val!(llvm_floatabi);
target_option_val!(relax_elf_relocations);
target_option_val!(llvm_args);
target_option_val!(use_ctors_section);

View file

@ -1085,6 +1085,35 @@ impl ToJson for CodeModel {
}
}
/// The float ABI setting to be configured in the LLVM target machine.
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
pub enum FloatAbi {
Soft,
Hard,
}
impl FromStr for FloatAbi {
type Err = ();
fn from_str(s: &str) -> Result<FloatAbi, ()> {
Ok(match s {
"soft" => FloatAbi::Soft,
"hard" => FloatAbi::Hard,
_ => return Err(()),
})
}
}
impl ToJson for FloatAbi {
fn to_json(&self) -> Json {
match *self {
FloatAbi::Soft => "soft",
FloatAbi::Hard => "hard",
}
.to_json()
}
}
#[derive(Clone, Copy, PartialEq, Hash, Debug)]
pub enum TlsModel {
GeneralDynamic,
@ -2150,6 +2179,8 @@ pub struct TargetOptions {
pub env: StaticCow<str>,
/// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"`
/// or `"eabihf"`. Defaults to "".
/// This field is *not* forwarded directly to LLVM; its primary purpose is `cfg(target_abi)`.
/// However, parts of the backend do check this field for specific values to enable special behavior.
pub abi: StaticCow<str>,
/// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
pub vendor: StaticCow<str>,
@ -2446,8 +2477,17 @@ pub struct TargetOptions {
pub llvm_mcount_intrinsic: Option<StaticCow<str>>,
/// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers
/// and the `-target-abi` flag in llc. In the LLVM API this is `MCOptions.ABIName`.
pub llvm_abiname: StaticCow<str>,
/// Control the float ABI to use, for architectures that support it. The only architecture we
/// currently use this for is ARM. Corresponds to the `-float-abi` flag in llc. In the LLVM API
/// this is `FloatABIType`. (clang's `-mfloat-abi` is similar but more complicated since it
/// can also affect the `soft-float` target feature.)
///
/// If not provided, LLVM will infer the float ABI from the target triple (`llvm_target`).
pub llvm_floatabi: Option<FloatAbi>,
/// Whether or not RelaxElfRelocation flag will be passed to the linker
pub relax_elf_relocations: bool,
@ -2719,6 +2759,7 @@ impl Default for TargetOptions {
mcount: "mcount".into(),
llvm_mcount_intrinsic: None,
llvm_abiname: "".into(),
llvm_floatabi: None,
relax_elf_relocations: false,
llvm_args: cvs![],
use_ctors_section: false,
@ -3153,7 +3194,8 @@ impl Target {
);
}
// Check that RISC-V targets always specify which ABI they use.
// Check that RISC-V targets always specify which ABI they use,
// and that ARM targets specify their float ABI.
match &*self.arch {
"riscv32" => {
check_matches!(
@ -3170,6 +3212,9 @@ impl Target {
"invalid RISC-V ABI name"
);
}
"arm" => {
check!(self.llvm_floatabi.is_some(), "ARM targets must specify their float ABI",)
}
_ => {}
}

View file

@ -1,4 +1,4 @@
use crate::spec::{SanitizerSet, Target, TargetOptions, base};
use crate::spec::{FloatAbi, SanitizerSet, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// https://developer.android.com/ndk/guides/abis.html#armeabi
features: "+strict-align,+v5te".into(),
supported_sanitizers: SanitizerSet::ADDRESS,

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+strict-align,+v6".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+strict-align,+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View file

@ -1,11 +1,8 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
// to determine the calling convention and float ABI, and it doesn't
// support the "musleabi" value.
llvm_target: "arm-unknown-linux-gnueabi".into(),
llvm_target: "arm-unknown-linux-musleabi".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Armv6 Linux with musl 1.2.3".into()),
tier: Some(2),
@ -17,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// Most of these settings are copied from the arm_unknown_linux_gnueabi
// target.
features: "+strict-align,+v6".into(),

View file

@ -1,11 +1,8 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and it
// doesn't support the "musleabihf" value.
llvm_target: "arm-unknown-linux-gnueabihf".into(),
llvm_target: "arm-unknown-linux-musleabihf".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Armv6 Linux with musl 1.2.3, hardfloat".into()),
tier: Some(2),
@ -17,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
// target.
features: "+strict-align,+v6,+vfp2,-d32".into(),

View file

@ -1,5 +1,5 @@
use crate::abi::Endian;
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+strict-align,+v8,+crc".into(),
endian: Endian::Big,
max_atomic_width: Some(64),

View file

@ -1,7 +1,9 @@
// Targets the Big endian Cortex-R4/R5 processor (ARMv7-R)
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
endian: Endian::Big,
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),

View file

@ -1,7 +1,9 @@
// Targets the Cortex-R4F/R5F processor (ARMv7-R)
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
endian: Endian::Big,
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),

View file

@ -9,7 +9,9 @@
//! The default link script is very likely wrong, so you should use
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs,
};
pub(crate) fn target() -> Target {
Target {
@ -34,6 +36,7 @@ pub(crate) fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+soft-float,+strict-align".into(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View file

@ -1,6 +1,6 @@
//! Targets the ARMv5TE, with code as `a32` code by default.
use crate::spec::{FramePointer, Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, FramePointer, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -26,6 +26,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
// * activate t32/a32 interworking
// * use arch ARMv5TE

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+soft-float,+strict-align".into(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View file

@ -1,12 +1,8 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
// FIXME: this comment below does not seem applicable?
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and LLVM
// doesn't support the "musleabihf" value.
llvm_target: "armv5te-unknown-linux-gnueabi".into(),
llvm_target: "armv5te-unknown-linux-musleabi".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Armv5TE Linux with musl 1.2.3".into()),
tier: Some(2),
@ -18,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+soft-float,+strict-align".into(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+soft-float,+strict-align".into(),
// Atomic operations provided by compiler-builtins
max_atomic_width: Some(32),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v6,+vfp2,-d32".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
///
@ -28,8 +28,9 @@ pub(crate) fn target() -> Target {
os: "horizon".into(),
env: "newlib".into(),
vendor: "nintendo".into(),
abi: "eabihf".into(),
cpu: "mpcore".into(),
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
families: cvs!["unix"],
linker: Some("arm-none-eabi-gcc".into()),
relocation_model: RelocModel::Static,

View file

@ -1,4 +1,4 @@
use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions, base};
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions, base};
// This target if is for the baseline of the Android v7a ABI
// in thumb mode. It's named armv7-* instead of thumbv7-*
@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".into(),
supported_sanitizers: SanitizerSet::ADDRESS,
max_atomic_width: Some(64),

View file

@ -1,4 +1,6 @@
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
os: "rtems".into(),
families: cvs!["unix"],
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
linker: None,
relocation_model: RelocModel::Static,

View file

@ -1,5 +1,5 @@
use crate::abi::Endian;
use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
/// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib).
///
@ -32,6 +32,7 @@ pub(crate) fn target() -> Target {
env: "newlib".into(),
vendor: "sony".into(),
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
no_default_libraries: false,
cpu: "cortex-a9".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
// hardfloat.
@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb2,+soft-float,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}__gnu_mcount_nc".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for glibc Linux on ARMv7 without NEON or
// thumb-mode. See the thumbv7neon variant for enabling both.
@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
// hardfloat.
@ -7,10 +7,7 @@ pub(crate) fn target() -> Target {
// Most of these settings are copied from the armv7_unknown_linux_gnueabi
// target.
Target {
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
// to determine the calling convention and float ABI, and it doesn't
// support the "musleabi" value.
llvm_target: "armv7-unknown-linux-gnueabi".into(),
llvm_target: "armv7-unknown-linux-musleabi".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Armv7-A Linux with musl 1.2.3".into()),
tier: Some(2),
@ -23,6 +20,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb2,+soft-float,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),

View file

@ -1,13 +1,10 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and LLVM
// doesn't support the "musleabihf" value.
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
llvm_target: "armv7-unknown-linux-musleabihf".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Armv7-A Linux with musl 1.2.3, hardfloat".into()),
tier: Some(2),
@ -22,6 +19,7 @@ pub(crate) fn target() -> Target {
// target.
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or
// hardfloat.
@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb2,+soft-float,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for uclibc Linux on ARMv7 without NEON,
// thumb-mode or hardfloat.
@ -18,11 +18,12 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb2,+soft-float,-neon".into(),
cpu: "generic".into(),
max_atomic_width: Some(64),
mcount: "_mcount".into(),
abi: "eabi".into(),
..base
},
}

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for uclibc Linux on ARMv7 without NEON or
// thumb-mode. See the thumbv7neon variant for enabling both.
@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
max_atomic_width: Some(64),
mcount: "_mcount".into(),
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
..base
},
}

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),
mcount: "__mcount".into(),

View file

@ -1,4 +1,6 @@
use crate::spec::{LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions};
use crate::spec::{
FloatAbi, LinkSelfContainedDefault, PanicStrategy, RelroLevel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb2,+soft-float,-neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
max_atomic_width: Some(64),

View file

@ -1,4 +1,4 @@
use crate::spec::{RelocModel, Target, TargetOptions, base};
use crate::spec::{FloatAbi, RelocModel, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
let base = base::solid::opts("asp3");
@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
linker: Some("arm-kmc-eabi-gcc".into()),
features: "+v7,+soft-float,+thumb2,-neon".into(),
relocation_model: RelocModel::Static,

View file

@ -1,4 +1,4 @@
use crate::spec::{RelocModel, Target, TargetOptions, base};
use crate::spec::{FloatAbi, RelocModel, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
let base = base::solid::opts("asp3");
@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
linker: Some("arm-kmc-eabi-gcc".into()),
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
relocation_model: RelocModel::Static,

View file

@ -14,11 +14,14 @@
// - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
// linking. rationale: matches `thumb` targets
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
let opts = TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),

View file

@ -5,11 +5,14 @@
// changes (list in `armv7a_none_eabi.rs`) to bring it closer to the bare-metal
// `thumb` & `aarch64` targets.
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
let opts = TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".into(),

View file

@ -1,6 +1,8 @@
// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,

View file

@ -1,6 +1,8 @@
// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,

View file

@ -1,6 +1,8 @@
// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
use crate::spec::{
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
linker: Some("rust-lld".into()),
relocation_model: RelocModel::Static,

View file

@ -9,7 +9,9 @@
//! The default link script is very likely wrong, so you should use
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
use crate::spec::{FramePointer, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs};
use crate::spec::{
FloatAbi, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs,
};
pub(crate) fn target() -> Target {
Target {
@ -34,6 +36,7 @@ pub(crate) fn target() -> Target {
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
// * activate t32/a32 interworking

View file

@ -1,6 +1,6 @@
//! Targets the ARMv5TE, with code as `t32` code by default.
use crate::spec::{FramePointer, Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, FramePointer, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -26,6 +26,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
// * activate t32/a32 interworking
// * use arch ARMv5TE

View file

@ -1,6 +1,6 @@
// Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture)
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
// with +strict-align.
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.

View file

@ -1,6 +1,6 @@
// Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture)
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -19,6 +19,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
// with +strict-align.
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.

View file

@ -1,4 +1,4 @@
use crate::spec::{LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions, base};
use crate::spec::{FloatAbi, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
let mut base = base::windows_msvc::opts();
@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
data_layout: "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: "arm".into(),
options: TargetOptions {
llvm_floatabi: Some(FloatAbi::Hard),
features: "+vfp3,+neon".into(),
max_atomic_width: Some(64),
// FIXME(jordanrh): use PanicStrategy::Unwind when SEH is

View file

@ -1,4 +1,4 @@
use crate::spec::{PanicStrategy, Target, TargetOptions, base};
use crate::spec::{FloatAbi, PanicStrategy, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -13,6 +13,7 @@ pub(crate) fn target() -> Target {
data_layout: "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
arch: "arm".into(),
options: TargetOptions {
llvm_floatabi: Some(FloatAbi::Hard),
features: "+vfp3,+neon".into(),
max_atomic_width: Some(64),
// FIXME(jordanrh): use PanicStrategy::Unwind when SEH is

View file

@ -9,7 +9,7 @@
// To opt-in to hardware accelerated floating point operations, you can use, for example,
// `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`.
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -26,6 +26,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
max_atomic_width: Some(32),
..base::thumb::opts()
},

View file

@ -8,7 +8,7 @@
//
// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag.
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -25,6 +25,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the
// Cortex-M7 (vfp5).
// Both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers

View file

@ -9,7 +9,7 @@
// To opt-in to hardware accelerated floating point operations, you can use, for example,
// `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`.
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -28,6 +28,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
max_atomic_width: Some(32),
..base::thumb::opts()
},

View file

@ -8,7 +8,7 @@
//
// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag.
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -27,6 +27,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the
// Cortex-M7 (vfp5).
// Both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers

View file

@ -1,6 +1,6 @@
// Targets the Cortex-M3 processor (ARMv7-M)
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
max_atomic_width: Some(32),
..base::thumb::opts()
},

View file

@ -1,6 +1,6 @@
// Targets the Cortex-M3 processor (ARMv7-M)
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -19,6 +19,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
max_atomic_width: Some(32),
..base::thumb::opts()
},

View file

@ -1,4 +1,4 @@
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, Target, TargetOptions, base};
// This target if is for the Android v7a ABI in thumb mode with
// NEON unconditionally enabled and, therefore, with 32 FPU registers
@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
max_atomic_width: Some(64),
..base

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for glibc Linux on ARMv7 with thumb mode enabled
// (for consistency with Android and Debian-based distributions)
@ -22,6 +22,7 @@ pub(crate) fn target() -> Target {
arch: "arm".into(),
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// Info about features at https://wiki.debian.org/ArmHardFloatPort
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
max_atomic_width: Some(64),

View file

@ -1,4 +1,4 @@
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
// This target is for musl Linux on ARMv7 with thumb mode enabled
// (for consistency with Android and Debian-based distributions)
@ -8,10 +8,7 @@ use crate::spec::{Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
// uses it to determine the calling convention and float ABI, and LLVM
// doesn't support the "musleabihf" value.
llvm_target: "armv7-unknown-linux-gnueabihf".into(),
llvm_target: "armv7-unknown-linux-musleabihf".into(),
metadata: crate::spec::TargetMetadata {
description: Some("Thumb2-mode ARMv7-A Linux with NEON, musl 1.2.3".into()),
tier: Some(3),
@ -26,6 +23,7 @@ pub(crate) fn target() -> Target {
// target.
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
features: "+v7,+thumb-mode,+thumb2,+vfp3,+neon".into(),
max_atomic_width: Some(64),
mcount: "\u{1}mcount".into(),

View file

@ -1,6 +1,6 @@
// Targets the Cortex-M23 processor (Baseline ARMv8-M)
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// ARMv8-M baseline doesn't support unaligned loads/stores so we disable them
// with +strict-align.
features: "+strict-align".into(),

View file

@ -1,6 +1,6 @@
// Targets the Cortex-M23 processor (Baseline ARMv8-M)
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -19,6 +19,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
// ARMv8-M baseline doesn't support unaligned loads/stores so we disable them
// with +strict-align.
features: "+strict-align".into(),

View file

@ -1,7 +1,7 @@
// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
// without the Floating Point extension.
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -18,6 +18,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
max_atomic_width: Some(32),
..base::thumb::opts()
},

View file

@ -1,7 +1,7 @@
// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
// with the Floating Point extension.
use crate::spec::{Target, TargetOptions, base};
use crate::spec::{FloatAbi, Target, TargetOptions, base};
pub(crate) fn target() -> Target {
Target {
@ -18,6 +18,7 @@ pub(crate) fn target() -> Target {
options: TargetOptions {
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// If the Floating Point extension is implemented in the Cortex-M33
// processor, the Cortex-M33 Technical Reference Manual states that
// the FPU uses the FPv5 architecture, single-precision instructions

View file

@ -1,7 +1,7 @@
// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
// without the Floating Point extension.
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabi".into(),
llvm_floatabi: Some(FloatAbi::Soft),
max_atomic_width: Some(32),
..base::thumb::opts()
},

View file

@ -1,7 +1,7 @@
// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
// with the Floating Point extension.
use crate::spec::{Target, TargetOptions, base, cvs};
use crate::spec::{FloatAbi, Target, TargetOptions, base, cvs};
pub(crate) fn target() -> Target {
Target {
@ -20,6 +20,7 @@ pub(crate) fn target() -> Target {
families: cvs!["unix"],
os: "nuttx".into(),
abi: "eabihf".into(),
llvm_floatabi: Some(FloatAbi::Hard),
// If the Floating Point extension is implemented in the Cortex-M33
// processor, the Cortex-M33 Technical Reference Manual states that
// the FPU uses the FPv5 architecture, single-precision instructions