Skip to content

Commit a5dac7a

Browse files
authored
Auto merge of #36874 - japaric:thumbs, r=alexcrichton
add Thumbs to the compiler this commit adds 4 new target definitions to the compiler for easier cross compilation to ARM Cortex-M devices. - `thumbv6m-none-eabi` - For the Cortex-M0, Cortex-M0+ and Cortex-M1 - This architecture doesn't have hardware support (instructions) for atomics. Hence, the `Atomic*` structs are not available for this target. - `thumbv7m-none-eabi` - For the Cortex-M3 - `thumbv7em-none-eabi` - For the FPU-less variants of the Cortex-M4 and Cortex-M7 - On this target, all the floating point operations will be lowered software routines (intrinsics) - `thumbv7em-none-eabihf` - For the variants of the Cortex-M4 and Cortex-M7 that do have a FPU. - On this target, all the floating point operations will be lowered to hardware instructions No binary releases of standard crates, like `core`, are planned for these targets because Cargo, in the future, will compile e.g. the `core` crate on the fly as part of the `cargo build` process. In the meantime, you'll have to compile the `core` crate yourself. [Xargo] is the easiest way to do that as in handles the compilation of `core` automatically and can be used just like Cargo: `xargo build --target thumbv6m-none-eabi` is all that's needed. [Xargo]: https://crates.io/crates/xargo --- cc @brson @alexcrichton
2 parents 4a9af01 + 6136069 commit a5dac7a

File tree

60 files changed

+291
-65
lines changed

Some content is hidden

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

60 files changed

+291
-65
lines changed

src/librustc/session/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
933933
let os = &sess.target.target.target_os;
934934
let env = &sess.target.target.target_env;
935935
let vendor = &sess.target.target.target_vendor;
936-
let max_atomic_width = sess.target.target.options.max_atomic_width;
936+
let max_atomic_width = sess.target.target.max_atomic_width();
937937

938938
let fam = if let Some(ref fam) = sess.target.target.options.target_family {
939939
intern(fam)

src/librustc_back/target/aarch64_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn target() -> TargetResult {
2525
options: TargetOptions {
2626
features: "+neon,+fp-armv8,+cyclone".to_string(),
2727
eliminate_frame_pointer: false,
28-
max_atomic_width: 128,
28+
max_atomic_width: Some(128),
2929
.. base
3030
},
3131
})

src/librustc_back/target/aarch64_linux_android.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetResult};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::android_base::opts();
15-
base.max_atomic_width = 128;
15+
base.max_atomic_width = Some(128);
1616
// As documented in http://developer.android.com/ndk/guides/cpu-features.html
1717
// the neon (ASIMD) and FP must exist on all android aarch64 targets.
1818
base.features = "+neon,+fp-armv8".to_string();

src/librustc_back/target/aarch64_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetResult};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
15-
base.max_atomic_width = 128;
15+
base.max_atomic_width = Some(128);
1616
Ok(Target {
1717
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
1818
target_endian: "little".to_string(),

src/librustc_back/target/arm_linux_androideabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::android_base::opts();
1515
base.features = "+v7,+vfp3,+d16".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717

1818
Ok(Target {
1919
llvm_target: "arm-linux-androideabi".to_string(),

src/librustc_back/target/arm_unknown_linux_gnueabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
15-
base.max_atomic_width = 64;
15+
base.max_atomic_width = Some(64);
1616
Ok(Target {
1717
llvm_target: "arm-unknown-linux-gnueabi".to_string(),
1818
target_endian: "little".to_string(),

src/librustc_back/target/arm_unknown_linux_gnueabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
1212

1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
15-
base.max_atomic_width = 64;
15+
base.max_atomic_width = Some(64);
1616
Ok(Target {
1717
llvm_target: "arm-unknown-linux-gnueabihf".to_string(),
1818
target_endian: "little".to_string(),

src/librustc_back/target/arm_unknown_linux_musleabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
1616
// Most of these settings are copied from the arm_unknown_linux_gnueabi
1717
// target.
1818
base.features = "+v6".to_string();
19-
base.max_atomic_width = 64;
19+
base.max_atomic_width = Some(64);
2020
Ok(Target {
2121
// It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
2222
// to determine the calling convention and float ABI, and it doesn't

src/librustc_back/target/arm_unknown_linux_musleabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn target() -> TargetResult {
1616
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
1717
// target.
1818
base.features = "+v6,+vfp2".to_string();
19-
base.max_atomic_width = 64;
19+
base.max_atomic_width = Some(64);
2020
Ok(Target {
2121
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
2222
// uses it to determine the calling convention and float ABI, and it

src/librustc_back/target/armv7_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
target_vendor: "apple".to_string(),
2525
options: TargetOptions {
2626
features: "+v7,+vfp3,+neon".to_string(),
27-
max_atomic_width: 64,
27+
max_atomic_width: Some(64),
2828
.. base
2929
}
3030
})

src/librustc_back/target/armv7_linux_androideabi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::android_base::opts();
1515
base.features = "+v7,+thumb2,+vfp3,+d16".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717

1818
Ok(Target {
1919
llvm_target: "armv7-none-linux-android".to_string(),

src/librustc_back/target/armv7_unknown_linux_gnueabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn target() -> TargetResult {
2626
// Info about features at https://wiki.debian.org/ArmHardFloatPort
2727
features: "+v7,+vfp3,+d16,+thumb2".to_string(),
2828
cpu: "generic".to_string(),
29-
max_atomic_width: 64,
29+
max_atomic_width: Some(64),
3030
.. base
3131
}
3232
})

src/librustc_back/target/armv7_unknown_linux_musleabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub fn target() -> TargetResult {
1717
// target.
1818
base.features = "+v7,+vfp3,+neon".to_string();
1919
base.cpu = "cortex-a8".to_string();
20-
base.max_atomic_width = 64;
20+
base.max_atomic_width = Some(64);
2121
Ok(Target {
2222
// It's important we use "gnueabihf" and not "musleabihf" here. LLVM
2323
// uses it to determine the calling convention and float ABI, and LLVM

src/librustc_back/target/armv7s_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
target_vendor: "apple".to_string(),
2525
options: TargetOptions {
2626
features: "+v7,+vfp4,+neon".to_string(),
27-
max_atomic_width: 64,
27+
max_atomic_width: Some(64),
2828
.. base
2929
}
3030
})

src/librustc_back/target/asmjs_unknown_emscripten.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn target() -> Result<Target, String> {
2121
linker_is_gnu: true,
2222
allow_asm: false,
2323
obj_is_bitcode: true,
24-
max_atomic_width: 32,
24+
max_atomic_width: Some(32),
2525
post_link_args: vec!["-s".to_string(), "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()],
2626
.. Default::default()
2727
};

src/librustc_back/target/i386_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
2323
target_env: "".to_string(),
2424
target_vendor: "apple".to_string(),
2525
options: TargetOptions {
26-
max_atomic_width: 64,
26+
max_atomic_width: Some(64),
2727
.. base
2828
}
2929
})

src/librustc_back/target/i686_apple_darwin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::apple_base::opts();
1515
base.cpu = "yonah".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717
base.pre_link_args.push("-m32".to_string());
1818

1919
Ok(Target {

src/librustc_back/target/i686_linux_android.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::android_base::opts();
1515

16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717

1818
// http://developer.android.com/ndk/guides/abis.html#x86
1919
base.cpu = "pentiumpro".to_string();

src/librustc_back/target/i686_pc_windows_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::windows_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717

1818
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1919
// space available to x86 Windows binaries on x86_64.

src/librustc_back/target/i686_pc_windows_msvc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::windows_msvc_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717

1818
// Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1919
// space available to x86 Windows binaries on x86_64.

src/librustc_back/target/i686_unknown_dragonfly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::dragonfly_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717
base.pre_link_args.push("-m32".to_string());
1818

1919
Ok(Target {

src/librustc_back/target/i686_unknown_freebsd.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::freebsd_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717
base.pre_link_args.push("-m32".to_string());
1818

1919
Ok(Target {

src/librustc_back/target/i686_unknown_haiku.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::haiku_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717
base.pre_link_args.push("-m32".to_string());
1818

1919
Ok(Target {

src/librustc_back/target/i686_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717
base.pre_link_args.push("-m32".to_string());
1818

1919
Ok(Target {

src/librustc_back/target/i686_unknown_linux_musl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
1313
pub fn target() -> TargetResult {
1414
let mut base = super::linux_musl_base::opts();
1515
base.cpu = "pentium4".to_string();
16-
base.max_atomic_width = 64;
16+
base.max_atomic_width = Some(64);
1717
base.pre_link_args.push("-m32".to_string());
1818
base.pre_link_args.push("-Wl,-melf_i386".to_string());
1919

src/librustc_back/target/le32_unknown_nacl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
exe_suffix: ".pexe".to_string(),
2525
linker_is_gnu: true,
2626
allow_asm: false,
27-
max_atomic_width: 32,
27+
max_atomic_width: Some(32),
2828
.. Default::default()
2929
};
3030
Ok(Target {

src/librustc_back/target/mips64_unknown_linux_gnuabi64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
// NOTE(mips64r2) matches C toolchain
2525
cpu: "mips64r2".to_string(),
2626
features: "+mips64r2".to_string(),
27-
max_atomic_width: 64,
27+
max_atomic_width: Some(64),
2828
..super::linux_base::opts()
2929
},
3030
})

src/librustc_back/target/mips64el_unknown_linux_gnuabi64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
// NOTE(mips64r2) matches C toolchain
2525
cpu: "mips64r2".to_string(),
2626
features: "+mips64r2".to_string(),
27-
max_atomic_width: 64,
27+
max_atomic_width: Some(64),
2828
..super::linux_base::opts()
2929
},
3030
})

src/librustc_back/target/mips_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
2323
options: TargetOptions {
2424
cpu: "mips32r2".to_string(),
2525
features: "+mips32r2".to_string(),
26-
max_atomic_width: 32,
26+
max_atomic_width: Some(32),
2727
..super::linux_base::opts()
2828
},
2929
})

src/librustc_back/target/mips_unknown_linux_musl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
2323
options: TargetOptions {
2424
cpu: "mips32r2".to_string(),
2525
features: "+mips32r2,+soft-float".to_string(),
26-
max_atomic_width: 32,
26+
max_atomic_width: Some(32),
2727
..super::linux_base::opts()
2828
}
2929
})

src/librustc_back/target/mips_unknown_linux_uclibc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
2323
options: TargetOptions {
2424
cpu: "mips32r2".to_string(),
2525
features: "+mips32r2,+soft-float".to_string(),
26-
max_atomic_width: 32,
26+
max_atomic_width: Some(32),
2727
..super::linux_base::opts()
2828
},
2929
})

src/librustc_back/target/mipsel_unknown_linux_gnu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
options: TargetOptions {
2525
cpu: "mips32".to_string(),
2626
features: "+mips32".to_string(),
27-
max_atomic_width: 32,
27+
max_atomic_width: Some(32),
2828
..super::linux_base::opts()
2929
},
3030
})

src/librustc_back/target/mipsel_unknown_linux_musl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn target() -> TargetResult {
2323
options: TargetOptions {
2424
cpu: "mips32".to_string(),
2525
features: "+mips32,+soft-float".to_string(),
26-
max_atomic_width: 32,
26+
max_atomic_width: Some(32),
2727
..super::linux_base::opts()
2828
}
2929
})

src/librustc_back/target/mipsel_unknown_linux_uclibc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn target() -> TargetResult {
2424
options: TargetOptions {
2525
cpu: "mips32".to_string(),
2626
features: "+mips32,+soft-float".to_string(),
27-
max_atomic_width: 32,
27+
max_atomic_width: Some(32),
2828
..super::linux_base::opts()
2929
},
3030
})

0 commit comments

Comments
 (0)