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

Lines changed: 3 additions & 2 deletions
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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

Lines changed: 4 additions & 1 deletion
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()),

0 commit comments

Comments
 (0)