-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add aarch64 support for macOS/darwin targets #10348
Add aarch64 support for macOS/darwin targets #10348
Conversation
Seems to return slightly higher precision on this platform
FWIW |
Is there something that should be changed regarding #10066 (comment) ? If I read things right |
Yeah, I think fiber switching is in good shape (we don't touch |
Looked into the details a bit more, and I think we're okay on the ABI: #10066 (comment) Made one alteration to the type of LibC::VaList on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, we don't have to have first tier support on the first try :)
Anyone already found a CI solution? Maybe there's a Linux distribution compiling against the Apple ABI that we can use for now on our AArch64 box or something like that?
Lil' bit more on the topic via GHA issue actions/runner#805 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Resolves #10066
Work from @RomainFranceschini and I, this PR adds the libc bindings for
aarch64-apple-darwin
(thanks Romain!) and implements proper handling for thearm64-apple-darwin
triple (which is a synonym, and presented by default via LLVM on Apple Silicon)Compiling requires a working
x86_64
crystal compiler (via Brew for e.g.) that can be run via Rosetta 2. For working on this, we've installed ARM homebrew to the/opt/homebrew
prefix and Intel Homebrew to its usual/usr/local
prefix. More info on that here.As the Intel homebrew is installed to a default lookup path,
x86_64
libraries will be read first, so we need to do some overriding of environment variables to get the linker to look up arm64/aarch64 libraries correctly.Cross-compilation instructions for the compiler:
Environment
Compiling libcrystal.a
Compiling bdw-gc
Then copy
.libs/libgc.a
into the Crystal source root(You can also
brew install --HEAD bdw-gc
, which has the MT patches too, and is effectively the same as doing the above.)Compiling Crystal for ARM
Compiling and running the compiler specs
Compiling and running the std library specs
Both sets of specs have been validated as passing, but please also try on your own hardware too if you cross-compile to validate.
The cross-compilation experience leaves a bit to be desired, unfortunately. I'm working on a separate PR to make it a bit nicer to cross-compile this all on one machine to avoid having to do so many gymnastics to compile for multiple targets.
Many thanks to @RomainFranceschini for kicking off this work and doing all the discovery, and @alin23 for validating it on their hardware as well