Support windows/arm target#256
Support windows/arm target#256alexcrichton merged 3 commits intorust-lang:masterfrom jordanrh1:windows-arm
Conversation
alexcrichton
left a comment
There was a problem hiding this comment.
Awesome, thanks for this!
build.rs
Outdated
| cfg.warnings(false); | ||
|
|
||
| if target_env == "msvc" { | ||
| if target_env == "msvc" && !target_arch_arm { |
There was a problem hiding this comment.
Hm is this right? This means that if we compile anything it'll use gcc-style flags, right?
There was a problem hiding this comment.
You're right, this change is incorrect.
There was a problem hiding this comment.
Undid the unnecessary changes. Let me know if you'd like me to squash.
| } | ||
|
|
||
| if target_arch == "arm" && target_os != "ios" { | ||
| if target_arch == "arm" && target_os != "ios" && target_env != "msvc" { |
There was a problem hiding this comment.
There's some C files below in addition to assembly files, should they be included even on MSVC?
There was a problem hiding this comment.
My understanding is that LLVM uses different builtins when targeting the msvc subsystem, for example __rt_udiv instead of __aeabi_uidivmod. I don't think the C files are required, and I haven't hit any errors yet due to their absence. I checked a few of the C files and they contain helper code for the assembly code.
|
Thanks! |
|
I would have squashed my changes and cleaned up the commit messages if I'd known you'd merge without squashing. |
|
Ah no worries! We're not too strict about the history |
Add target thumbv7a-pc-windows-msvc This is an early draft of support for Windows/ARM. To test it, 1. Install Visual Studio 2017 and Windows SDK version 17134. 1. Obtain alexcrichton/xz2-rs#35, rust-lang/compiler-builtins#256, and the fix for [LLVM Bug 38620](https://bugs.llvm.org/show_bug.cgi?id=38620). 2. Open a command prompt and run ``` set CC_thumbv7a-pc-windows-msvc=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.11.25503\bin\HostX64\arm\CL.exe set CFLAGS_thumbv7a-pc-windows-msvc=/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 /nologo c:\python27\python.exe x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc ``` It will build the stage 2 compiler, but fail building stage 2 test. To build an executable targeting windows/arm, 1. Copy `build\x86_64-pc-windows-msvc\stage0\bin\cargo.exe` to `build\x86_64-pc-windows-msvc\stage2\bin` 2. Open a command prompt and run ``` "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat" set PATH=build\x86_64-pc-windows-msvc\stage2\bin;%PATH% cargo new hello cd hello cargo build --target thumbv7a-pc-windows-msvc –release ``` Copy target\thumbv7a-pc-windows-msvc\release\hello.exe to your platform and run. There are a number of open issues that I'm hoping to get help with: - Error when compiling the `test` crate: `error: cannot link together two panic runtimes: panic_abort and panic_unwind` - Warnings when building the compiler_builtins crate: `warning: cl : Command line warning D9002 : ignoring unknown option '-fvisibility=hidden'`. It looks like the build system is passing GCC-style flags to MSVC. - How to specify the LIBPATH entries for ARM. Right now they are hardcoded as absolute paths in the target spec. This pull request depends on - alexcrichton/xz2-rs#35 - update vcxproj to Visual Studio 2017 - rust-lang/compiler-builtins#256 - fix compile errors when building for windows/arm - [Bug 38620 - ARM: Incorrect COFF relocation type for thumb bl instruction](https://bugs.llvm.org/show_bug.cgi?id=38620) This PR updates #52659
Do not compile assembly files that cannot be compiled with the MSVC toolchain.