From be337381393c733bbd8f1469fecfdfc85d5f3bd7 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Sat, 20 Apr 2019 18:24:29 +0300 Subject: [PATCH 1/4] Added arm-none-eabi target --- src/ci/docker/dist-various-1/Dockerfile | 2 ++ src/librustc_target/spec/arm_none_eabi.rs | 34 +++++++++++++++++++++++ src/librustc_target/spec/mod.rs | 1 + src/tools/build-manifest/src/main.rs | 1 + 4 files changed, 38 insertions(+) create mode 100644 src/librustc_target/spec/arm_none_eabi.rs diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index a722a4183912e..f5ce2b1fbd49d 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -120,6 +120,7 @@ ENV TARGETS=$TARGETS,armebv7r-none-eabi ENV TARGETS=$TARGETS,armebv7r-none-eabihf ENV TARGETS=$TARGETS,armv7r-none-eabi ENV TARGETS=$TARGETS,armv7r-none-eabihf +ENV TARGETS=$TARGETS,arm-none-eabi ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ @@ -127,6 +128,7 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \ CC_armebv7r_none_eabi=arm-none-eabi-gcc \ + CC_arm_none_eabi=arm-none-eabi-gcc \ CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \ AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \ CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ diff --git a/src/librustc_target/spec/arm_none_eabi.rs b/src/librustc_target/spec/arm_none_eabi.rs new file mode 100644 index 0000000000000..e505f37017308 --- /dev/null +++ b/src/librustc_target/spec/arm_none_eabi.rs @@ -0,0 +1,34 @@ +// Generic arm target for bare-metal code +// +// Can be used in conjunction with the `target-feature` and +// `target-cpu` compiler flags to opt-in more hardware-specific +// features. +// +// For example, `-C target-cpu=cortex-a7`. + +use super::{LinkerFlavor, Target, TargetOptions, PanicStrategy}; + +pub fn target() -> Result { + Ok(Target { + llvm_target: "arm-none-eabi".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "none".to_string(), + target_env: String::new(), + target_vendor: String::new(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+strict-align,+v6".to_string(), + executables: true, + relocation_model: "static".to_string(), + max_atomic_width: Some(64), + panic_strategy: PanicStrategy::Abort, + abi_blacklist: super::arm_base::abi_blacklist(), + .. Default::default() + }, + }) +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 46fefd78f4519..ff318e7fb0254 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -351,6 +351,7 @@ supported_targets! { ("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu), ("sparc-unknown-linux-gnu", sparc_unknown_linux_gnu), ("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu), + ("arm-none-eabi", arm_none_eabi), ("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi), ("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf), ("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi), diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 61cc78ad807af..31d3a058bfe5b 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -49,6 +49,7 @@ static TARGETS: &[&str] = &[ "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "arm-linux-androideabi", + "arm-none-eabi", "arm-unknown-linux-gnueabi", "arm-unknown-linux-gnueabihf", "arm-unknown-linux-musleabi", From d8cc8dcbcfc7826d7d9e2ccb426d9d447268aa19 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Tue, 23 Apr 2019 11:20:04 +0300 Subject: [PATCH 2/4] Added armv7-none target instead of arm-none --- src/ci/docker/dist-various-1/Dockerfile | 4 ++-- .../spec/{arm_none_eabi.rs => armv7_none_eabihf.rs} | 11 ++++++----- src/librustc_target/spec/mod.rs | 2 +- src/tools/build-manifest/src/main.rs | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) rename src/librustc_target/spec/{arm_none_eabi.rs => armv7_none_eabihf.rs} (72%) diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index f5ce2b1fbd49d..4623c5847cc11 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -120,7 +120,7 @@ ENV TARGETS=$TARGETS,armebv7r-none-eabi ENV TARGETS=$TARGETS,armebv7r-none-eabihf ENV TARGETS=$TARGETS,armv7r-none-eabi ENV TARGETS=$TARGETS,armv7r-none-eabihf -ENV TARGETS=$TARGETS,arm-none-eabi +ENV TARGETS=$TARGETS,armv7-none-eabihf ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ @@ -128,7 +128,7 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \ CC_armebv7r_none_eabi=arm-none-eabi-gcc \ - CC_arm_none_eabi=arm-none-eabi-gcc \ + CC_armv7_none_eabihf=arm-none-eabi-gcc \ CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \ AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \ CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ diff --git a/src/librustc_target/spec/arm_none_eabi.rs b/src/librustc_target/spec/armv7_none_eabihf.rs similarity index 72% rename from src/librustc_target/spec/arm_none_eabi.rs rename to src/librustc_target/spec/armv7_none_eabihf.rs index e505f37017308..61b47dfdbb9dd 100644 --- a/src/librustc_target/spec/arm_none_eabi.rs +++ b/src/librustc_target/spec/armv7_none_eabihf.rs @@ -6,11 +6,11 @@ // // For example, `-C target-cpu=cortex-a7`. -use super::{LinkerFlavor, Target, TargetOptions, PanicStrategy}; +use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; -pub fn target() -> Result { +pub fn target() -> TargetResult { Ok(Target { - llvm_target: "arm-none-eabi".to_string(), + llvm_target: "armv7-none-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), @@ -19,10 +19,11 @@ pub fn target() -> Result { target_os: "none".to_string(), target_env: String::new(), target_vendor: String::new(), - linker_flavor: LinkerFlavor::Gcc, + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: TargetOptions { - features: "+strict-align,+v6".to_string(), + features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + linker: Some("rust-lld".to_owned()), executables: true, relocation_model: "static".to_string(), max_atomic_width: Some(64), diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index ff318e7fb0254..f4d5bfd274304 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -351,7 +351,7 @@ supported_targets! { ("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu), ("sparc-unknown-linux-gnu", sparc_unknown_linux_gnu), ("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu), - ("arm-none-eabi", arm_none_eabi), + ("armv7-none-eabihf", armv7_none_eabihf), ("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi), ("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf), ("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi), diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 31d3a058bfe5b..2d9ec6eb442c3 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -49,7 +49,6 @@ static TARGETS: &[&str] = &[ "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "arm-linux-androideabi", - "arm-none-eabi", "arm-unknown-linux-gnueabi", "arm-unknown-linux-gnueabihf", "arm-unknown-linux-musleabi", @@ -67,6 +66,7 @@ static TARGETS: &[&str] = &[ "armv7r-none-eabi", "armv7r-none-eabihf", "armv7s-apple-ios", + "armv7-none-eabihf", "asmjs-unknown-emscripten", "i386-apple-ios", "i586-pc-windows-msvc", From bd42e124688b952ce9e47de53731313ae0d04ff4 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Tue, 23 Apr 2019 14:39:26 +0300 Subject: [PATCH 3/4] Set armv7-none to use strict alignment --- src/librustc_target/spec/armv7_none_eabihf.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc_target/spec/armv7_none_eabihf.rs b/src/librustc_target/spec/armv7_none_eabihf.rs index 61b47dfdbb9dd..708f888933e3a 100644 --- a/src/librustc_target/spec/armv7_none_eabihf.rs +++ b/src/librustc_target/spec/armv7_none_eabihf.rs @@ -22,7 +22,7 @@ pub fn target() -> TargetResult { linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), options: TargetOptions { - features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + features: "+strict-align,+v7,+vfp3,+d16,+thumb2,-neon".to_string(), linker: Some("rust-lld".to_owned()), executables: true, relocation_model: "static".to_string(), From c8baec9cd08a984c8d5438d6dc6017cded9e5369 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Wed, 24 Apr 2019 08:59:27 +0300 Subject: [PATCH 4/4] Added non hf armv7a target --- src/ci/docker/dist-various-1/Dockerfile | 6 ++-- src/librustc_target/spec/armv7a_none_eabi.rs | 35 +++++++++++++++++++ ...7_none_eabihf.rs => armv7a_none_eabihf.rs} | 4 +-- src/librustc_target/spec/mod.rs | 3 +- src/tools/build-manifest/src/main.rs | 3 +- 5 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/librustc_target/spec/armv7a_none_eabi.rs rename src/librustc_target/spec/{armv7_none_eabihf.rs => armv7a_none_eabihf.rs} (90%) diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index 4623c5847cc11..0c8d08ffa1d7a 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -120,7 +120,8 @@ ENV TARGETS=$TARGETS,armebv7r-none-eabi ENV TARGETS=$TARGETS,armebv7r-none-eabihf ENV TARGETS=$TARGETS,armv7r-none-eabi ENV TARGETS=$TARGETS,armv7r-none-eabihf -ENV TARGETS=$TARGETS,armv7-none-eabihf +ENV TARGETS=$TARGETS,armv7a-none-eabi +ENV TARGETS=$TARGETS,armv7a-none-eabihf ENV TARGETS=$TARGETS,thumbv7neon-unknown-linux-gnueabihf ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ @@ -128,7 +129,8 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ CC_x86_64_unknown_redox=x86_64-unknown-redox-gcc \ CC_armebv7r_none_eabi=arm-none-eabi-gcc \ - CC_armv7_none_eabihf=arm-none-eabi-gcc \ + CC_armv7a_none_eabi=arm-none-eabi-gcc \ + CC_armv7a_none_eabihf=arm-none-eabi-gcc \ CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \ AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \ CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ diff --git a/src/librustc_target/spec/armv7a_none_eabi.rs b/src/librustc_target/spec/armv7a_none_eabi.rs new file mode 100644 index 0000000000000..78eedb88bfd06 --- /dev/null +++ b/src/librustc_target/spec/armv7a_none_eabi.rs @@ -0,0 +1,35 @@ +// Generic ARM-v7 Cortex-A target, with software floating-point emulation. +// +// Can be used in conjunction with the `target-feature` and +// `target-cpu` compiler flags to opt-in more hardware-specific +// features. +// +// For example, `-C target-cpu=cortex-a7`. + +use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + Ok(Target { + llvm_target: "armv7a-none-eabi".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "none".to_string(), + target_env: String::new(), + target_vendor: String::new(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + + options: TargetOptions { + features: "+strict-align,+v7,+thumb2,-neon".to_string(), + linker: Some("rust-lld".to_owned()), + executables: true, + relocation_model: "static".to_string(), + max_atomic_width: Some(64), + panic_strategy: PanicStrategy::Abort, + abi_blacklist: super::arm_base::abi_blacklist(), + .. Default::default() + }, + }) +} diff --git a/src/librustc_target/spec/armv7_none_eabihf.rs b/src/librustc_target/spec/armv7a_none_eabihf.rs similarity index 90% rename from src/librustc_target/spec/armv7_none_eabihf.rs rename to src/librustc_target/spec/armv7a_none_eabihf.rs index 708f888933e3a..dc42080e85b35 100644 --- a/src/librustc_target/spec/armv7_none_eabihf.rs +++ b/src/librustc_target/spec/armv7a_none_eabihf.rs @@ -1,4 +1,4 @@ -// Generic arm target for bare-metal code +// Generic ARM-v7 Cortex-A target, with hardware floating-point. // // Can be used in conjunction with the `target-feature` and // `target-cpu` compiler flags to opt-in more hardware-specific @@ -10,7 +10,7 @@ use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, Target, TargetOptions, pub fn target() -> TargetResult { Ok(Target { - llvm_target: "armv7-none-eabihf".to_string(), + llvm_target: "armv7a-none-eabihf".to_string(), target_endian: "little".to_string(), target_pointer_width: "32".to_string(), target_c_int_width: "32".to_string(), diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index f4d5bfd274304..70c77e7e6c347 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -351,7 +351,8 @@ supported_targets! { ("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu), ("sparc-unknown-linux-gnu", sparc_unknown_linux_gnu), ("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu), - ("armv7-none-eabihf", armv7_none_eabihf), + ("armv7a-none-eabi", armv7a_none_eabi), + ("armv7a-none-eabihf", armv7a_none_eabihf), ("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi), ("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf), ("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi), diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 2d9ec6eb442c3..e9da8940573de 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -66,7 +66,8 @@ static TARGETS: &[&str] = &[ "armv7r-none-eabi", "armv7r-none-eabihf", "armv7s-apple-ios", - "armv7-none-eabihf", + "armv7a-none-eabi", + "armv7a-none-eabihf", "asmjs-unknown-emscripten", "i386-apple-ios", "i586-pc-windows-msvc",