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
windows-arm64 support #8995
windows-arm64 support #8995
Conversation
Credits to MSYS2 Ruby package using this patch.
Fix compilation error when using MSYS2 environment. Credits to MSYS2 Ruby package using this patch.
When adding preprocessor option for llvm-windres (using clang as parameter), it fails. Thus, do not add this. It's needed to be able to compile windows-arm64 version, because MSYS2 toolchain is LLVM based (instead of GCC/binutils).
This fixes "unexpected ucrtbase.dll" for native windows-arm64 ruby binary. It does not solve issue with x64 version emulated on this platform. Value of pioinfo pointer can be found in ucrtbase.dll at latest adrp/add sequence before return of _isatty function. This works for both release and debug ucrt. Due to the nature of aarch64 ISA (vs x86 or x64), it's needed to disassemble instructions to retrieve offset value, which is a bit more complicated than matching specific string patterns. Details about adrp/add usage can be found in this blog post: https://devblogs.microsoft.com/oldnewthing/20220809-00/?p=106955 For instruction decoding, the Arm documentation was used as a reference.
For now, 2 tests are failing. I can investigate and fix this, once this PR will be merged.
|
@dennisameling @lazka You could be interested by some of those patches for MSYS2 Ruby package. It would enable clangarm64 version of it (I didn't try yet to build additional gems). |
@nurse You're welcome to review it, as this |
Out of curiosity, would it be possible to remove/replace that __pioinfo mess entirely? The assembly instructions in ucrtbase may change anytime in any Windows version. |
@larskanis did something in that area last year: https://bugs.ruby-lang.org/issues/18605#note-6 I don't know what the status there is. |
I completely agree that the best solution would be to get rid of For now, it's a tentative to have a pragmatic solution, and hopefully, @ArminG-MSFT can make sure ucrtbase |
The patch looks good. Thank you for your contribution! |
As lazka quoted and larskanis said, to remove
As far as I understand Python is under slightly different situation because they don't provide HANDLE/SOCKET unification. (their Perl seems similar situation, but they introduced another hack this year (!). Perl/perl5@8552f09 |
fyi, the USE_LLVM_WINDRES workaround in this PR should no longer be needed starting with llvm v18, and the relevant llvm changes are backported in MSYS2 as of today -> msys2/MINGW-packages#19524 |
This series allows to build and run Ruby natively on windows-arm64.
It contains fixes for build system (some of them taken from MSYS2 Ruby package).
Most of the work is detection of
__pioinfo
pointer, which was the blocking step. Details are available in commit message. This was tested on windows-arm64 11 retail build (not insiders).You can find a build log here, that uses this script from an MSYS2 clangarm64 shell.
I'm not sure if Ruby community accepts a serie of patches, or if several PR are needed. Let me know.
Note: This is an effort part of my work at Linaro.