Skip to content

Commit

Permalink
Rollup merge of rust-lang#60895 - chandde:master, r=alexcrichton
Browse files Browse the repository at this point in the history
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\?**
  • Loading branch information
Centril authored May 19, 2019
2 parents 5c84d77 + 759921e commit 815d3ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,10 +795,10 @@ fn create_msvc_imps(
return
}
// The x86 ABI seems to require that leading underscores are added to symbol
// names, so we need an extra underscore on 32-bit. There's also a leading
// names, so we need an extra underscore on x86. There's also a leading
// '\x01' here which disables LLVM's symbol mangling (e.g., no extra
// underscores added in front).
let prefix = if cgcx.target_pointer_width == "32" {
let prefix = if cgcx.target_arch == "x86" {
"\x01__imp__"
} else {
"\x01__imp_"
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_ssa/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
pub tm_factory: TargetMachineFactory<B>,
pub msvc_imps_needed: bool,
pub target_pointer_width: String,
pub target_arch: String,
pub debuginfo: config::DebugInfo,

// Number of cgus excluding the allocator/metadata modules
Expand Down Expand Up @@ -1103,6 +1104,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
total_cgus,
msvc_imps_needed: msvc_imps_needed(tcx),
target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
target_arch: tcx.sess.target.target.arch.clone(),
debuginfo: tcx.sess.opts.debuginfo,
assembler_cmd,
};
Expand Down
9 changes: 5 additions & 4 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ extern crate libc;
use term;

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

pub use self::ColorConfig::*;
Expand Down

0 comments on commit 815d3ba

Please sign in to comment.