-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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 new rustc
target for Arm64 machines that can target the iphonesimulator
#81966
Add new rustc
target for Arm64 machines that can target the iphonesimulator
#81966
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e74e5c0
to
07663fd
Compare
tl;dr: I finally made this work with my static libraries to work inside the iOS simulator on an M1 macbook pro. I had to use the triple heads up: This is based on #81451 to get LLVM 12. I have not tested yet if that's required. Details on how I got there: First I looked at what the difference is between C code compiled for arm64 iOS and for arm64 iOS Simulator:
As you can see the simulator one uses After a bunch of tries, trying to trace the rustc and LLVM code I was unable to fully determine how LLVM decides which way to use. So I went back to look at the C code again. Here's the relevant difference between
Low and behold: the triple has the version in it. So I swapped out the triple in
There we go! Now it turns out: for macOS we do the same: we put the deployment target version into the triple: rust/compiler/rustc_target/src/spec/apple_base.rs Lines 57 to 65 in a118ee2
I guess we need to start doing that for iOS too? I can work on integrating that into the code of this PR. |
Awesome detective work @badboy !!!! Looks like we'll need LLVM12 still I tried building against the latest and I'm still getting:
|
Well, that one might be because sqlite3 is built with the wrong target. If sqlite3 is built using the I should fine some time tomorrow to extend this PR with the necessary steps and also look into |
💯 adding that flag to my build script works I can run my app, this is awesome @badboy 😃 I'll let you add your commits as I am sure it's much cleaner than my branch is now lol |
not sure if you noticed, but I sent a PR to your branch here: deg4uss3r#1 |
Seems believable, and it sounds like two separate people got it to work, so that's about as good of testing as I'd expect for this level. Would you mind squashing the commits (don't really need the intermediate "fix formatting") and then we can merge! |
1b40a9c
to
df142b6
Compare
df142b6
to
e36eef8
Compare
@shepmaster ungracefully done! |
@deg4uss3r You can squash the typo fix, too. I really don't care about credit for something that minor. |
LLVM picks the right things to put into the compiled object file based on the target deployment version. We need to communicate it through the target triple. Only with that LLVM will use the right commands in the file to make it look and behave like code compiled for the arm64 iOS simulator target.
e36eef8
to
8d6ad11
Compare
@bors r+ rollup Thanks! |
📌 Commit 8d6ad11 has been approved by |
Rollup of 11 pull requests Successful merges: - rust-lang#81300 (BTree: share panicky test code & test panic during clear, clone) - rust-lang#81706 (Document BinaryHeap unsafe functions) - rust-lang#81833 (parallelize x.py test tidy) - rust-lang#81966 (Add new `rustc` target for Arm64 machines that can target the iphonesimulator) - rust-lang#82154 (Update RELEASES.md 1.50 to include methods stabilized in rust-lang#79342) - rust-lang#82177 (Do not delete bootstrap.exe on Windows during clean) - rust-lang#82181 (Add check for ES5 in CI) - rust-lang#82229 (Add [A-diagnostics] bug report template) - rust-lang#82233 (try-back-block-type test: Use TryFromSliceError for From test) - rust-lang#82302 (Remove unsafe impl Send for CompletedTest & TestResult) - rust-lang#82349 (test: Print test name only once on timeout) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR lands a new target (
aarch64-apple-ios-sim
) that targets arm64 iphone simulator, previously unreachable from Apple Silicon machines.resolves #81632
r? @shepmaster