-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mingw-w64-cross-clang arm and aarch64 targets #2294
Conversation
This was able to build a test c++ program for armv7 and aarch64, that worked on Windows arm64 (on a raspberry pi) |
Nice |
Why add the targets here instead of mingw-w64-clang package? The compiler will not depend on msys2 layer. |
I thought of that too. This is the only set of "cross" clang packages I think. I know that clang itself can generate code for all platforms, but the libraries shipped with mingw-w64-clang are only "native", as far as I know you can't even link i686 binaries out-of-the-box with mingw-w64-x86_64-clang (since there is no Also, I believe new prefixes historically "spring forth" by being cross-compiled from msys2, not from mingw. |
Agreed but we've to compile/port MINGW-packages to aarch64, so I was thinking of adding a version of llvm-mingw in hypothetical This cross compiler will create native aarch64 compiler but that hardware is not available to everyone and the current ones for consumer are slow (except M1). |
AFAIK it's not decided yet whether ARM/AArch64 subsystems should be native or cross-compiled. If they end up being cross-compiled then we'd use x86_64 cross Clang for bootstrapping. |
I had a try last night to bootstrap clang on aarch64-w64-mingw32 from the CLANG-packages bootstrap branch... it failed on sanitizer_win.cpp. Well, getting closer anyway |
Sanitizers don't build with BFD but should build with LLD, for cross packages they are unnecessary though. |
The problem was actually that sanitizers are not (yet?) supported on Windows arm/aarch64. |
Ah right, I thought sanitizers are supported by AArch64 but it might have been not merged yet. |
@jeremyd2019 I have a Surface Pro X (ARM64), feel free to ping my if you'd like me to test anything 👍🏼 heard that Windows 10 on the Raspberry Pi isn't the fastest |
On arches other than i686/x86_64, it can be assumed that 0xA00 is a safe minimum _WIN32_WINNT version.
The armv7 lib needs to be called 'arm' not 'armv7' for clang to find it.
13875e2
to
095b480
Compare
Huh, this used to build. Wonder what happened |
@mati865 any clue what might be going on? It looks like
|
I have no idea and cannot look into it within next 16 hours. |
OK. I am making some headway I think. |
If I tried some more versions to try to narrow it down. ✔️ cmake-3.18.4-1 |
b88f5bc
to
095b480
Compare
I have no idea, did you try comparing compiler-builtins from working and broken CMake? |
Here is a zip with the working and broken aarch64 compiler-rt libs. |
I had a thought that maybe it was running msys2 ranlib instead of llvm-ranlib, but I just saw a post about how ranlib hasn't actually been needed for years/decades... https://sourceware.org/pipermail/binutils/2021-April/116084.html |
W T F. running llvm-ranlib on the broken one seems to 'fix' it. Well at least I've got a workaround now |
Sorry to bother you like this @mstorsjo but I guess you are the only one who can have any idea what is going on in the last few comments (#2294 (comment) and later). |
Well I tried cross-building my toolchain with CMake 3.20.1 (both the current pinned version with LLVM 11, and with a RC of LLVM 12) and it builds fine in both cases, but I configure with I'd be interested in seeing a log of the build of compiler-rt with 3.19 vs 3.20 in the case where things break (built with
Hey, don't be sorry, I'm happy to help out with people poking these things! FWIW, I see that you also have the hardcoded hackery for renaming around the arm version of compiler-rt builtins. I've worked on this in the current git main branch (for the 13 release), with that one won't need to hack around with the library names for i386 vs i686 and arm vs armv7 any longer, and just do a |
Ah, we are using Verbose log sounds like good idea, we should also replace environment variables with |
Output of |
Oddly, CMAKE_AR and CMAKE_RANLIB seem to look in the current working directory for a simple |
Yep.
Ok, but how did work/differ in 3.19? |
Log with |
66e0894
to
ba42be4
Compare
Ok, so it implicitly chose llvm-ar for some reason, but no longer does - I guess that's understandable. |
|
Oh, right, I forgot that bit. RIght, then it makes sense - thanks! |
It seems cmake >= 3.20 doesn't respect AR and RANLIB environment variables anymore. Also, cmake seems to use ASM and -DCMAKE_ASM_COMPILER, not AS.
ba42be4
to
f268369
Compare
Is this waiting on anything more from me? |
Btw, on this topic, how do you call windres for these cross targets? I guess you currently use something like my windres wrapper tool. I'm working on a proper llvm-windres tool upstream (https://reviews.llvm.org/D100756), which would avoid to use any out-of-tree tools for that purpose. But my question is how you prefer to pass the target arch - in llvm-mingw, I have symlinks (copies) of the binaries with names like But as GNU binutils don't support COFF-aarch64, there's no canonical BFD target names for that (I guess one could just choose to define |
Oh, my response was not delivered last time.
I think we are just waiting on @lazka.
We are using your exact wrapper: MSYS2 structure is a bit weird and we don't really have cross compilation. Each target is actually a host so we just call |
Oh, so you build a wrapper with a hardcoded default target arch via Hmm, how would that work for the upstream llvm-windres binary then? Do you build your whole LLVM setup with something like |
Exactly. |
Oh, ok. That should work just fine then. For other setups - do you happen to have any opinion on the the "BFD format" option to windres, whether to extend it to allow full triples or extend it with new BFD-like format names like "pe-aarch64", or just make up an entirely new syntax for specifying a triple to target? (In particular, being able to write a full triple is kinda useful to let the preprocessor find its sysroot, in case it's not |
@lazka I don't want to be a pest, but I am waiting on this to merge msys2/CLANG-packages#2 and start bootstrapping 🚀 |
thanks! |
This PR adds armv7-w64-mingw32 and aarch64-w64-mingw32 targets for mingw-w64-cross-clang{,-headers,-crt} and mingw-w64-cross-compiler-rt.