Skip to content
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 macOS AArch64 support #1248

Open
5 of 6 tasks
bjorn3 opened this issue Jul 24, 2022 · 5 comments
Open
5 of 6 tasks

Add macOS AArch64 support #1248

bjorn3 opened this issue Jul 24, 2022 · 5 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-arm Target: ARM processors (arm, thumb and AArch64 targets) O-macos Operating system: MacOS

Comments

@bjorn3
Copy link
Member

bjorn3 commented Jul 24, 2022

CirrusCI now has support for running on M1 macs: https://cirrus-ci.org/guide/macOS/

Branch to run on CirrusCI: https://github.com/bjorn3/rustc_codegen_cranelift/tree/macos_m1_ci

@bjorn3 bjorn3 added C-enhancement Category: An issue proposing an enhancement or a PR with one. O-macos Operating system: MacOS O-arm Target: ARM processors (arm, thumb and AArch64 targets) labels Jul 24, 2022
@nathanwhit
Copy link
Member

I've been looking into this recently. I currently have the full sysroot compiling and passing most of the tests. I've opened a PR for the first set of changes required (supporting the necessary relocations in the object crate). I'm still working on cleaning up the cranelift changes and debugging a few issues before opening PRs.

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 19, 2022

Thanks a lot for working on this!

@bjorn3
Copy link
Member Author

bjorn3 commented Mar 25, 2023

bytecodealliance/wasmtime#5434 has been merged, so tls should work now. Variadic functions like printf will need proper Cranelift support as with the AArch64 macOS ABI variadic arguments are always passed on the stack. The current workaround for missing variadic function support in Cranelift depends on the ABI for variadic arguments being the same as non-variadic arguments, like is the case on most platforms. I will probably also need to hard code support for objc_msgSend as it can have multiple signatures at the same time depending on the passed in message selector.

@bjorn3
Copy link
Member Author

bjorn3 commented Jan 25, 2024

I just updated the macos_m1_ci branch to test it on cirrus ci. After disabling all debuginfo generation and skipping the tests that use printf (as it is a variadic function), the rest of the tests pass.

@bjorn3
Copy link
Member Author

bjorn3 commented Jan 26, 2024

Turns out there is at least one place in libstd where a variadic function is called: https://cirrus-ci.com/task/4835070486249472?logs=test#L116 This can't work until #1451 is fixed. I could make all these calls abort as workaround, but it doesn't sit right with me to announce that arm64 macOS works with that in place.

Edit: Yeah, just tried with an LLVM sysroot and even that will locally codegen the vararg open() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-arm Target: ARM processors (arm, thumb and AArch64 targets) O-macos Operating system: MacOS
Projects
None yet
Development

No branches or pull requests

2 participants