Skip to content

Commit 815d3ba

Browse files
authored
Rollup merge of rust-lang#60895 - chandde:master, r=alexcrichton
Enable thumbv7a-pc-windows-msvc target build end to end in rust/master With this PR, plus another commit rust-lang/compiler-builtins@cf98161, I'm able to build the target thumbv7a-pc-windows-msvc successfully, and I'm able to use the stage2 artifacts to build arm32 projects. The commit in compiler_builtins is in release 0.1.14, the current cargo.lock in rust master still uses 0.1.12, so I bumped the compiler_builtins version in cargo.lock to 0.1.15 The command I used to build rust ``` c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc --verbose ``` **Changes** 1. update cargolock to use compiler_builtins 0.1.15 2. handle libunwind in libtest for thumv7a the same as what we have for aarch64 3. in llvm codegen add a field in CodegenContext to carry the arch, so later in create_msvc_imps function, the arch can be used to check against "x86", instead of 32 pointer width. Apparently Thumv7a is handled differently than x86. **Background** I'm from Microsoft working on enabling Azure IoTEdge on ARM32 Windows IoTCore, Azure IoTEdge has a component called IoTEdged written in rust as a NT service running on Windows, so we need to enable rust on thumbv7a in order to have full IoTEdge. My colleague had made some heavy lifting and we've been using our private toolchain to build IoTEdged in our devops pipeline, because at that time we cannot build thumbv7a target end to end successfully. This change is a followup to enable the end to end build for thumbv7a-pc-windows-msvc target. **Next step** I'll submit more changes to have this target built nightly in rust/master, to achieve the same availability for aarch64-pc-windows-msvc, indexed here https://rust-lang.github.io/rustup-components-history/aarch64-pc-windows-msvc.html and can be manually installed. **Please do share what takes to make this happen, is there a formal process I need to follow\?**
2 parents 5c84d77 + 759921e commit 815d3ba

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/librustc_codegen_llvm/back/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -795,10 +795,10 @@ fn create_msvc_imps(
795795
return
796796
}
797797
// The x86 ABI seems to require that leading underscores are added to symbol
798-
// names, so we need an extra underscore on 32-bit. There's also a leading
798+
// names, so we need an extra underscore on x86. There's also a leading
799799
// '\x01' here which disables LLVM's symbol mangling (e.g., no extra
800800
// underscores added in front).
801-
let prefix = if cgcx.target_pointer_width == "32" {
801+
let prefix = if cgcx.target_arch == "x86" {
802802
"\x01__imp__"
803803
} else {
804804
"\x01__imp_"

src/librustc_codegen_ssa/back/write.rs

+2
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
248248
pub tm_factory: TargetMachineFactory<B>,
249249
pub msvc_imps_needed: bool,
250250
pub target_pointer_width: String,
251+
pub target_arch: String,
251252
pub debuginfo: config::DebugInfo,
252253

253254
// Number of cgus excluding the allocator/metadata modules
@@ -1103,6 +1104,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
11031104
total_cgus,
11041105
msvc_imps_needed: msvc_imps_needed(tcx),
11051106
target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
1107+
target_arch: tcx.sess.target.target.arch.clone(),
11061108
debuginfo: tcx.sess.opts.debuginfo,
11071109
assembler_cmd,
11081110
};

src/libtest/lib.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ extern crate libc;
3737
use term;
3838

3939
// FIXME(#54291): rustc and/or LLVM don't yet support building with panic-unwind
40-
// on aarch64-pc-windows-msvc, so we don't link libtest against
41-
// libunwind (for the time being), even though it means that
42-
// libtest won't be fully functional on this platform.
40+
// on aarch64-pc-windows-msvc, or thumbv7a-pc-windows-msvc
41+
// so we don't link libtest against libunwind (for the time being)
42+
// even though it means that libtest won't be fully functional on
43+
// these platforms.
4344
//
4445
// See also: https://github.com/rust-lang/rust/issues/54190#issuecomment-422904437
45-
#[cfg(not(all(windows, target_arch = "aarch64")))]
46+
#[cfg(not(all(windows, any(target_arch = "aarch64", target_arch = "arm"))))]
4647
extern crate panic_unwind;
4748

4849
pub use self::ColorConfig::*;

0 commit comments

Comments
 (0)