From fff026c8e572809cfce7202ec1ad63897b72c5b0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 30 Dec 2024 18:10:59 +0100 Subject: [PATCH 1/4] rustc_llvm: expose FloatABIType target machine parameter --- .../src/back/owned_target_machine.rs | 4 +-- compiler/rustc_codegen_llvm/src/back/write.rs | 10 +++---- compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 13 ++++++++-- .../rustc_llvm/llvm-wrapper/PassWrapper.cpp | 26 +++++++++++++++---- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs b/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs index 44c30d22a9e9c..4cbd49aa44d48 100644 --- a/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs +++ b/compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs @@ -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, diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index ae5e818d86f10..ba4492b49365b 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -40,7 +40,7 @@ use crate::errors::{ WithLlvmError, WriteBytecode, }; use crate::llvm::diagnostic::OptimizationDiagnosticKind::*; -use crate::llvm::{self, DiagnosticInfo, PassManager}; +use crate::llvm::{self, DiagnosticInfo, FloatAbi, PassManager}; use crate::type_::Type; use crate::{LlvmCodegenBackend, ModuleLlvm, base, common, llvm_util}; @@ -189,12 +189,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 { + 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 + FloatAbi::Default }; let ffunction_sections = @@ -290,7 +290,7 @@ pub(crate) fn target_machine_factory( code_model, reloc_model, opt_level, - use_softfp, + float_abi, ffunction_sections, fdata_sections, funique_section_names, diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 9a2bfd95562f2..128a147963b4a 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -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, diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 20859b167bc6b..de14c6d188365 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -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 static size_t getLongestEntryLength(ArrayRef 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; From a0dbb37ebd7919df4b698deb356e024a741283ec Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 30 Dec 2024 19:08:03 +0100 Subject: [PATCH 2/4] add llvm_floatabi field to target spec that controls FloatABIType --- compiler/rustc_codegen_llvm/src/back/write.rs | 16 ++++++-- compiler/rustc_target/src/spec/json.rs | 14 +++++++ compiler/rustc_target/src/spec/mod.rs | 41 +++++++++++++++++++ 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index ba4492b49365b..806f810627d51 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -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; @@ -40,7 +40,7 @@ use crate::errors::{ WithLlvmError, WriteBytecode, }; use crate::llvm::diagnostic::OptimizationDiagnosticKind::*; -use crate::llvm::{self, DiagnosticInfo, FloatAbi, PassManager}; +use crate::llvm::{self, DiagnosticInfo, PassManager}; use crate::type_::Type; use crate::{LlvmCodegenBackend, ModuleLlvm, base, common, llvm_util}; @@ -181,6 +181,14 @@ pub(crate) fn to_llvm_code_model(code_model: Option) -> llvm::CodeMod } } +fn to_llvm_float_abi(float_abi: Option) -> 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, @@ -190,11 +198,11 @@ pub(crate) fn target_machine_factory( let (opt_level, _) = to_llvm_opt_settings(optlvl); let float_abi = if sess.target.arch == "arm" && sess.opts.cg.soft_float { - FloatAbi::Soft + 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. - FloatAbi::Default + to_llvm_float_abi(sess.target.llvm_floatabi) }; let ffunction_sections = diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs index 206766325aa16..9cdc0801b1f00 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -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::() { + 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); diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index ad746d3f26b85..c25788b97e5e2 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -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 { + 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, /// 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, /// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown". pub vendor: StaticCow, @@ -2446,8 +2477,17 @@ pub struct TargetOptions { pub llvm_mcount_intrinsic: Option>, /// 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, + /// 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, + /// 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, From a51fefcaab835b310e2e26005b50982d0049d905 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 30 Dec 2024 19:47:05 +0100 Subject: [PATCH 3/4] explicitly set float ABI for all ARM targets --- compiler/rustc_target/src/spec/base/apple/mod.rs | 5 +++-- compiler/rustc_target/src/spec/mod.rs | 6 +++++- .../rustc_target/src/spec/targets/arm_linux_androideabi.rs | 3 ++- .../src/spec/targets/arm_unknown_linux_gnueabi.rs | 3 ++- .../src/spec/targets/arm_unknown_linux_gnueabihf.rs | 3 ++- .../src/spec/targets/arm_unknown_linux_musleabi.rs | 3 ++- .../src/spec/targets/arm_unknown_linux_musleabihf.rs | 3 ++- .../src/spec/targets/armeb_unknown_linux_gnueabi.rs | 3 ++- .../rustc_target/src/spec/targets/armebv7r_none_eabi.rs | 5 ++++- .../rustc_target/src/spec/targets/armebv7r_none_eabihf.rs | 5 ++++- compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs | 5 ++++- .../src/spec/targets/armv4t_unknown_linux_gnueabi.rs | 3 ++- compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs | 3 ++- .../src/spec/targets/armv5te_unknown_linux_gnueabi.rs | 3 ++- .../src/spec/targets/armv5te_unknown_linux_musleabi.rs | 3 ++- .../src/spec/targets/armv5te_unknown_linux_uclibceabi.rs | 3 ++- .../rustc_target/src/spec/targets/armv6_unknown_freebsd.rs | 3 ++- .../src/spec/targets/armv6_unknown_netbsd_eabihf.rs | 3 ++- .../rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs | 5 +++-- .../src/spec/targets/armv7_linux_androideabi.rs | 3 ++- .../rustc_target/src/spec/targets/armv7_rtems_eabihf.rs | 5 ++++- .../src/spec/targets/armv7_sony_vita_newlibeabihf.rs | 3 ++- .../rustc_target/src/spec/targets/armv7_unknown_freebsd.rs | 3 ++- .../src/spec/targets/armv7_unknown_linux_gnueabi.rs | 3 ++- .../src/spec/targets/armv7_unknown_linux_gnueabihf.rs | 3 ++- .../src/spec/targets/armv7_unknown_linux_musleabi.rs | 3 ++- .../src/spec/targets/armv7_unknown_linux_musleabihf.rs | 3 ++- .../src/spec/targets/armv7_unknown_linux_ohos.rs | 3 ++- .../src/spec/targets/armv7_unknown_linux_uclibceabi.rs | 5 +++-- .../src/spec/targets/armv7_unknown_linux_uclibceabihf.rs | 3 ++- .../src/spec/targets/armv7_unknown_netbsd_eabihf.rs | 3 ++- .../rustc_target/src/spec/targets/armv7_unknown_trusty.rs | 5 ++++- .../src/spec/targets/armv7_wrs_vxworks_eabihf.rs | 3 ++- .../src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs | 3 ++- .../src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs | 3 ++- compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs | 5 ++++- .../rustc_target/src/spec/targets/armv7a_none_eabihf.rs | 5 ++++- compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs | 5 ++++- .../rustc_target/src/spec/targets/armv7r_none_eabihf.rs | 5 ++++- .../rustc_target/src/spec/targets/armv8r_none_eabihf.rs | 5 ++++- .../rustc_target/src/spec/targets/thumbv4t_none_eabi.rs | 5 ++++- .../rustc_target/src/spec/targets/thumbv5te_none_eabi.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv6m_none_eabi.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs | 3 ++- .../src/spec/targets/thumbv7a_pc_windows_msvc.rs | 3 ++- .../src/spec/targets/thumbv7a_uwp_windows_msvc.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv7em_none_eabi.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv7m_none_eabi.rs | 3 ++- .../rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs | 3 ++- .../src/spec/targets/thumbv7neon_linux_androideabi.rs | 3 ++- .../src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs | 3 ++- .../spec/targets/thumbv7neon_unknown_linux_musleabihf.rs | 3 ++- .../src/spec/targets/thumbv8m_base_none_eabi.rs | 3 ++- .../src/spec/targets/thumbv8m_base_nuttx_eabi.rs | 3 ++- .../src/spec/targets/thumbv8m_main_none_eabi.rs | 3 ++- .../src/spec/targets/thumbv8m_main_none_eabihf.rs | 3 ++- .../src/spec/targets/thumbv8m_main_nuttx_eabi.rs | 3 ++- .../src/spec/targets/thumbv8m_main_nuttx_eabihf.rs | 3 ++- 61 files changed, 150 insertions(+), 64 deletions(-) diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs index f45c86640936f..497994a5998cb 100644 --- a/compiler/rustc_target/src/spec/base/apple/mod.rs +++ b/compiler/rustc_target/src/spec/base/apple/mod.rs @@ -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, StaticCow) { 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), diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index c25788b97e5e2..02962d55a60ed 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -3194,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!( @@ -3211,6 +3212,9 @@ impl Target { "invalid RISC-V ABI name" ); } + "arm" => { + check!(self.llvm_floatabi.is_some(), "ARM targets must specify their float ABI",) + } _ => {} } diff --git a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs index 677d0f905b773..73fb02c67310c 100644 --- a/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs index 5948d6b01f098..87e790a1f39e4 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs index 1e07a3cf2fda1..6470bf6b61157 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 416bb5432fd1c..273f47edd952f 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -1,4 +1,4 @@ -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 { 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(), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 909eb78f6983d..2c2809a2d9607 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -1,4 +1,4 @@ -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 { 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(), diff --git a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs index 07382a30863bb..bac9b39bbf2ae 100644 --- a/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs index d09624e0e7391..db774323e7be6 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs @@ -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()), diff --git a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs index 10669dcf09d79..de006a92668fb 100644 --- a/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs @@ -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()), diff --git a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs index 3d525ba403c7d..dc8cb4fb187ec 100644 --- a/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs @@ -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",], diff --git a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs index 7ca2babffe9fc..081132b0e68ca 100644 --- a/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs index 7f0a7791ca660..e0a4f26f0a6fd 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs index 9e8c81f133388..ce7060b384798 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index 5e3ad42e5a41e..2867243cc6d17 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -1,4 +1,4 @@ -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 { 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), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs index 154103c36f79c..73013bf00b10b 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs index 75447479e1c1e..4bbc514f2b3de 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs index 6ed50df531498..6b9d3ccd2152f 100644 --- a/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs index d78f62238b4a3..b323d2f86558e 100644 --- a/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs +++ b/compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs index 52a5402775012..e1cead9e0b7b8 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs index 4238c4c1c15f1..8c3bff2a90638 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs index 18843124d8e15..18d834597d87e 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs index 11399b777a57e..34f118d4f5ddd 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs index 240edd8a3560b..bb28427c99bf5 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs index eedaa6b32209c..6bffc0da87b01 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index 843adcfc71116..3069311fe2571 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -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. @@ -23,6 +23,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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index e0630817bc3ae..2799480c02b24 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -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 or NEON. @@ -22,6 +22,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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs index 92b09bcc45c48..d1261202124c8 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs index 0cc128940211d..ffcd8876eb4c8 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs @@ -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 }, } diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs index abf7f122adf02..586bd8d3d883e 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs @@ -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 }, } diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs index a639bf99d3c4a..28d3d572bf35d 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs index 1ad91b8f080e7..b86c788df15f6 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_trusty.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs index e815a646a4fa6..212c45424dbb5 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs index e5ae1064d9716..2ed1004541265 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs index 0879fa24a1b73..c9c15b402ae87 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs index 1e4798abfffb0..d59849ec2c4b1 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabi.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs index ab8b870c62859..06481e6f88253 100644 --- a/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7a_none_eabihf.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs index aba55f533a71d..1eda05451691a 100644 --- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabi.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs index 5a8519dcc49d0..d4e85bc9b0aea 100644 --- a/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs index 762084291a696..3df42a1482c18 100644 --- a/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv8r_none_eabihf.rs @@ -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, diff --git a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs index 6368cbfe7c21d..b0eefcab209e2 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs index afd48e6ea1669..1439e4a939f0b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs index 1eac51b8e0a77..4333a9c631c89 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs @@ -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. diff --git a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs index 0a6dc88c1457b..5799bbf551f8b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs @@ -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. diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs index 861604987f84c..a62d03ba0d32d 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs index bb30f81fb20b5..c9df66253b36f 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs index d35d30c34a31c..b5cf8ce74f4c3 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs @@ -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() }, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs index c439059728280..c7b54b94efa7c 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs index 0f3457402a593..536d128590fb4 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs @@ -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() }, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs index 99612e132a9d0..35e92b81d87da 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs index 1727add111509..50f7bc1f810ad 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs @@ -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() }, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs index 07c19376a311a..320867444ad29 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs @@ -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() }, diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs index 19bb515e3c306..de3ac26a2bd9c 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs index 45de2e82f5a88..120f13ae56d73 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index a0852b4611ecd..4928e33ca7c1c 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -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) @@ -26,6 +26,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(), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs index 3856cdff05c77..823fb828e4dfc 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs index 9f493b6904594..1af01b97666fe 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs @@ -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(), diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs index 3f8d20f48f76d..47304e3027d93 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs @@ -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() }, diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs index 7c8fa078e2628..ddb5132ba6054 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs @@ -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 diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs index f73360e8501ac..661d74217adf6 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs @@ -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() }, diff --git a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs index cf642e3189612..484d35bfc2028 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs @@ -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 From c3189c585f9f8f80104d7b4791739f59eca405f7 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 30 Dec 2024 19:49:12 +0100 Subject: [PATCH 4/4] musleabi* targets: we no longer need to set gnueabi* for LLVM now that we set the float ABI explicitly --- .../src/spec/targets/arm_unknown_linux_musleabi.rs | 5 +---- .../src/spec/targets/arm_unknown_linux_musleabihf.rs | 5 +---- .../src/spec/targets/armv5te_unknown_linux_musleabi.rs | 6 +----- .../src/spec/targets/armv7_unknown_linux_musleabi.rs | 5 +---- .../src/spec/targets/armv7_unknown_linux_musleabihf.rs | 5 +---- .../spec/targets/thumbv7neon_unknown_linux_musleabihf.rs | 5 +---- 6 files changed, 6 insertions(+), 25 deletions(-) diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs index 273f47edd952f..26241dd0bd481 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs @@ -2,10 +2,7 @@ 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), diff --git a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs index 2c2809a2d9607..4bbde7667b976 100644 --- a/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs @@ -2,10 +2,7 @@ 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), diff --git a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs index 2867243cc6d17..62619546891de 100644 --- a/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs @@ -2,11 +2,7 @@ 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), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs index 3069311fe2571..0436e0d8df4ce 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs @@ -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), diff --git a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs index 2799480c02b24..22e49f2f1b0b8 100644 --- a/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs @@ -4,10 +4,7 @@ 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 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), diff --git a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs index 4928e33ca7c1c..1149b6d16eb2b 100644 --- a/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs +++ b/compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs @@ -8,10 +8,7 @@ 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 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),