Skip to content

Commit a51fefc

Browse files
committed
explicitly set float ABI for all ARM targets
1 parent a0dbb37 commit a51fefc

File tree

61 files changed

+150
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+150
-64
lines changed

compiler/rustc_target/src/spec/base/apple/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::borrow::Cow;
22
use std::env;
33

44
use crate::spec::{
5-
Cc, DebuginfoKind, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, StaticCow,
6-
TargetOptions, cvs,
5+
Cc, DebuginfoKind, FloatAbi, FramePointer, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType,
6+
StaticCow, TargetOptions, cvs,
77
};
88

99
#[cfg(test)]
@@ -105,6 +105,7 @@ pub(crate) fn base(
105105
) -> (TargetOptions, StaticCow<str>, StaticCow<str>) {
106106
let opts = TargetOptions {
107107
abi: abi.target_abi().into(),
108+
llvm_floatabi: Some(FloatAbi::Hard),
108109
os: os.into(),
109110
cpu: arch.target_cpu(abi).into(),
110111
link_env_remove: link_env_remove(os),

compiler/rustc_target/src/spec/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -3194,7 +3194,8 @@ impl Target {
31943194
);
31953195
}
31963196

3197-
// Check that RISC-V targets always specify which ABI they use.
3197+
// Check that RISC-V targets always specify which ABI they use,
3198+
// and that ARM targets specify their float ABI.
31983199
match &*self.arch {
31993200
"riscv32" => {
32003201
check_matches!(
@@ -3211,6 +3212,9 @@ impl Target {
32113212
"invalid RISC-V ABI name"
32123213
);
32133214
}
3215+
"arm" => {
3216+
check!(self.llvm_floatabi.is_some(), "ARM targets must specify their float ABI",)
3217+
}
32143218
_ => {}
32153219
}
32163220

compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{SanitizerSet, Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, SanitizerSet, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabi".into(),
17+
llvm_floatabi: Some(FloatAbi::Soft),
1718
// https://developer.android.com/ndk/guides/abis.html#armeabi
1819
features: "+strict-align,+v5te".into(),
1920
supported_sanitizers: SanitizerSet::ADDRESS,

compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabi".into(),
17+
llvm_floatabi: Some(FloatAbi::Soft),
1718
features: "+strict-align,+v6".into(),
1819
max_atomic_width: Some(64),
1920
mcount: "\u{1}__gnu_mcount_nc".into(),

compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabihf".into(),
17+
llvm_floatabi: Some(FloatAbi::Hard),
1718
features: "+strict-align,+v6,+vfp2,-d32".into(),
1819
max_atomic_width: Some(64),
1920
mcount: "\u{1}__gnu_mcount_nc".into(),

compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
1717
arch: "arm".into(),
1818
options: TargetOptions {
1919
abi: "eabi".into(),
20+
llvm_floatabi: Some(FloatAbi::Soft),
2021
// Most of these settings are copied from the arm_unknown_linux_gnueabi
2122
// target.
2223
features: "+strict-align,+v6".into(),

compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -17,6 +17,7 @@ pub(crate) fn target() -> Target {
1717
arch: "arm".into(),
1818
options: TargetOptions {
1919
abi: "eabihf".into(),
20+
llvm_floatabi: Some(FloatAbi::Hard),
2021
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
2122
// target.
2223
features: "+strict-align,+v6,+vfp2,-d32".into(),

compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use crate::spec::{Target, TargetOptions, base};
2+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
33

44
pub(crate) fn target() -> Target {
55
Target {
@@ -15,6 +15,7 @@ pub(crate) fn target() -> Target {
1515
arch: "arm".into(),
1616
options: TargetOptions {
1717
abi: "eabi".into(),
18+
llvm_floatabi: Some(FloatAbi::Soft),
1819
features: "+strict-align,+v8,+crc".into(),
1920
endian: Endian::Big,
2021
max_atomic_width: Some(64),

compiler/rustc_target/src/spec/targets/armebv7r_none_eabi.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Targets the Big endian Cortex-R4/R5 processor (ARMv7-R)
22

33
use crate::abi::Endian;
4-
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
4+
use crate::spec::{
5+
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
6+
};
57

68
pub(crate) fn target() -> Target {
79
Target {
@@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
1719
arch: "arm".into(),
1820
options: TargetOptions {
1921
abi: "eabi".into(),
22+
llvm_floatabi: Some(FloatAbi::Soft),
2023
endian: Endian::Big,
2124
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2225
linker: Some("rust-lld".into()),

compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Targets the Cortex-R4F/R5F processor (ARMv7-R)
22

33
use crate::abi::Endian;
4-
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
4+
use crate::spec::{
5+
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
6+
};
57

68
pub(crate) fn target() -> Target {
79
Target {
@@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
1719
arch: "arm".into(),
1820
options: TargetOptions {
1921
abi: "eabihf".into(),
22+
llvm_floatabi: Some(FloatAbi::Hard),
2023
endian: Endian::Big,
2124
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
2225
linker: Some("rust-lld".into()),

compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
//! The default link script is very likely wrong, so you should use
1010
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12-
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
12+
use crate::spec::{
13+
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs,
14+
};
1315

1416
pub(crate) fn target() -> Target {
1517
Target {
@@ -34,6 +36,7 @@ pub(crate) fn target() -> Target {
3436
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
3537
options: TargetOptions {
3638
abi: "eabi".into(),
39+
llvm_floatabi: Some(FloatAbi::Soft),
3740
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
3841
linker: Some("rust-lld".into()),
3942
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],

compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabi".into(),
17+
llvm_floatabi: Some(FloatAbi::Soft),
1718
features: "+soft-float,+strict-align".into(),
1819
// Atomic operations provided by compiler-builtins
1920
max_atomic_width: Some(32),

compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Targets the ARMv5TE, with code as `a32` code by default.
22
3-
use crate::spec::{FramePointer, Target, TargetOptions, base, cvs};
3+
use crate::spec::{FloatAbi, FramePointer, Target, TargetOptions, base, cvs};
44

55
pub(crate) fn target() -> Target {
66
Target {
@@ -26,6 +26,7 @@ pub(crate) fn target() -> Target {
2626

2727
options: TargetOptions {
2828
abi: "eabi".into(),
29+
llvm_floatabi: Some(FloatAbi::Soft),
2930
// extra args passed to the external assembler (assuming `arm-none-eabi-as`):
3031
// * activate t32/a32 interworking
3132
// * use arch ARMv5TE

compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabi".into(),
17+
llvm_floatabi: Some(FloatAbi::Soft),
1718
features: "+soft-float,+strict-align".into(),
1819
// Atomic operations provided by compiler-builtins
1920
max_atomic_width: Some(32),

compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -18,6 +18,7 @@ pub(crate) fn target() -> Target {
1818
arch: "arm".into(),
1919
options: TargetOptions {
2020
abi: "eabi".into(),
21+
llvm_floatabi: Some(FloatAbi::Soft),
2122
features: "+soft-float,+strict-align".into(),
2223
// Atomic operations provided by compiler-builtins
2324
max_atomic_width: Some(32),

compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabi".into(),
17+
llvm_floatabi: Some(FloatAbi::Soft),
1718
features: "+soft-float,+strict-align".into(),
1819
// Atomic operations provided by compiler-builtins
1920
max_atomic_width: Some(32),

compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabihf".into(),
17+
llvm_floatabi: Some(FloatAbi::Hard),
1718
features: "+v6,+vfp2,-d32".into(),
1819
max_atomic_width: Some(64),
1920
mcount: "\u{1}__gnu_mcount_nc".into(),

compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabihf".into(),
17+
llvm_floatabi: Some(FloatAbi::Hard),
1718
features: "+v6,+vfp2,-d32".into(),
1819
max_atomic_width: Some(64),
1920
mcount: "__mcount".into(),

compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
1+
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
22

33
/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
44
///
@@ -28,8 +28,9 @@ pub(crate) fn target() -> Target {
2828
os: "horizon".into(),
2929
env: "newlib".into(),
3030
vendor: "nintendo".into(),
31-
abi: "eabihf".into(),
3231
cpu: "mpcore".into(),
32+
abi: "eabihf".into(),
33+
llvm_floatabi: Some(FloatAbi::Hard),
3334
families: cvs!["unix"],
3435
linker: Some("arm-none-eabi-gcc".into()),
3536
relocation_model: RelocModel::Static,

compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions, base};
1+
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions, base};
22

33
// This target if is for the baseline of the Android v7a ABI
44
// in thumb mode. It's named armv7-* instead of thumbv7-*
@@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
2424
arch: "arm".into(),
2525
options: TargetOptions {
2626
abi: "eabi".into(),
27+
llvm_floatabi: Some(FloatAbi::Soft),
2728
features: "+v7,+thumb-mode,+thumb2,+vfp3,-d32,-neon".into(),
2829
supported_sanitizers: SanitizerSet::ADDRESS,
2930
max_atomic_width: Some(64),

compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
1+
use crate::spec::{
2+
Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs,
3+
};
24

35
pub(crate) fn target() -> Target {
46
Target {
@@ -17,6 +19,7 @@ pub(crate) fn target() -> Target {
1719
os: "rtems".into(),
1820
families: cvs!["unix"],
1921
abi: "eabihf".into(),
22+
llvm_floatabi: Some(FloatAbi::Hard),
2023
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
2124
linker: None,
2225
relocation_model: RelocModel::Static,

compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::abi::Endian;
2-
use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
2+
use crate::spec::{Cc, FloatAbi, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
33

44
/// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib).
55
///
@@ -32,6 +32,7 @@ pub(crate) fn target() -> Target {
3232
env: "newlib".into(),
3333
vendor: "sony".into(),
3434
abi: "eabihf".into(),
35+
llvm_floatabi: Some(FloatAbi::Hard),
3536
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
3637
no_default_libraries: false,
3738
cpu: "cortex-a9".into(),

compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
pub(crate) fn target() -> Target {
44
Target {
@@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
1414
arch: "arm".into(),
1515
options: TargetOptions {
1616
abi: "eabihf".into(),
17+
llvm_floatabi: Some(FloatAbi::Hard),
1718
features: "+v7,+vfp3,-d32,+thumb2,-neon".into(),
1819
max_atomic_width: Some(64),
1920
mcount: "\u{1}__gnu_mcount_nc".into(),

compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

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

compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

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

compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::spec::{Target, TargetOptions, base};
1+
use crate::spec::{FloatAbi, Target, TargetOptions, base};
22

33
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
44
// hardfloat.
@@ -23,6 +23,7 @@ pub(crate) fn target() -> Target {
2323

2424
options: TargetOptions {
2525
abi: "eabi".into(),
26+
llvm_floatabi: Some(FloatAbi::Soft),
2627
features: "+v7,+thumb2,+soft-float,-neon".into(),
2728
max_atomic_width: Some(64),
2829
mcount: "\u{1}mcount".into(),

0 commit comments

Comments
 (0)