-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Use /usr/bin/strip
on macOS -> iOS cross as a temporary workaround
#138250
Conversation
@bors try |
[WIP] Use `/usr/bin/strip` on macOS -> iOS cross as a temporary mitigation Mitigation for <rust-lang#138212>. This reintroduces the "hard-coded strip" workaround (but only for iOS) that was initially introduced in rust-lang#130781. Looks like LLVM 20's initial `llvm-objcopy` version that we ship as `rust-objcopy` may be producing stripped iOS binaries with invalid offsets that fail iOS platform consistency checks. For the time being, use macOS system strip at `/usr/bin/strip` which should be available (unlike Linux -> macOS cross where this is not guaranteed to be available, partially why we are shipping `llvm-objcopy` in the first place[^linux-darwin-cross]) that shouldn't have this offset problem. ### Review and testing advice I don't have access to either macOS or iOS platforms, and I can't really write a test for this. This will need to be tested manually. r? `@davidtwco` (or reroll) cc *-apple-ios target maintainers `@badboy` `@deg4uss3r` `@madsmtm` try-job: dist-apple-various try-job: dist-x86_64-apple [^linux-darwin-cross]: rust-lang#131206
☀️ Try build successful - checks-actions |
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.
Fine with this workaround (depending on how long llvm/llvm-project#130472 takes).
Does CI run "macOS host, iOS target" run-make tests on CI? If so, we could check that (Though I don't know if we actually want such a test, ideally we should be able to rely on |
/usr/bin/strip
on macOS -> iOS cross as a temporary mitigation/usr/bin/strip
on macOS -> iOS cross as a temporary workaround
I think we do run run-make tests on macOS-to-iOS, but I think we probably don't want to maintain our own |
/usr/bin/strip
on macOS -> iOS cross as a temporary workaround/usr/bin/strip
on macOS -> iOS cross as a temporary workaround
For <rust-lang#138212>. Looks like LLVM 20's initial `llvm-objcopy` version that we ship as `rust-objcopy` may be producing stripped iOS binaries with invalid offsets that fail iOS platform consistency checks. For the time being, use macOS system strip at `/usr/bin/strip` which should be available (unlike Linux -> macOS cross where this is not guaranteed to be available, partially why we are shipping `llvm-objcopy` in the first place) that shouldn't have this offset problem.
This probably still needs someone with access to the native envs to try an end-to-end test to see if the resulting @rustbot ready |
Some changes occurred in compiler/rustc_codegen_ssa |
@bors try |
Use `/usr/bin/strip` on macOS -> iOS cross as a temporary workaround Crude workaround for <rust-lang#138212> to unblock nightly macOS-to-iOS cross builds. This reintroduces the "hard-coded strip" workaround (but only for iOS) that was initially introduced in rust-lang#130781. Looks like LLVM 20's initial `llvm-objcopy` version that we ship as `rust-objcopy` may be producing stripped iOS binaries with invalid offsets that fail iOS platform consistency checks. For the time being, use macOS system strip when cross-compiling from macOS -> iOS at `/usr/bin/strip` which should be available (unlike Linux -> macOS cross where this is not guaranteed to be available, partially why we are shipping `llvm-objcopy` in the first place[^linux-darwin-cross]) that shouldn't have this offset problem. ### Alternatives - We *could* also try to use a `strip` from PATH. *However*, that can regress iOS users if they have broken homebrew binutils strip in their PATH that take precedence over a "good" strip. - We could also wait for upstream `llvm-objcopy` fixes. ### Review and testing advice I don't have access to either macOS or iOS platforms, and I can't really write a test for this. This will need to be tested manually. r? `@davidtwco` (or reroll) cc *-apple-ios target maintainers `@badboy` `@deg4uss3r` `@madsmtm` try-job: dist-apple-various try-job: dist-x86_64-apple try-job: dist-aarch64-apple [^linux-darwin-cross]: rust-lang#131206
☀️ Try build successful - checks-actions |
I'm back at work tomorrow and can probably take some time and get me a Rust build to try this. |
I did build rustc with this patch. And |
No worries, thanks for trying anyway :D |
Closing in favor of proper upstream fix #138695 |
Backup crude workaround for #138212 to unblock nightly macOS-to-iOS cross builds. This reintroduces the "hard-coded strip" workaround (but only for iOS) that was initially introduced in #130781.
Looks like LLVM 20's initial
llvm-objcopy
version that we ship asrust-objcopy
may be producing stripped iOS binaries with invalid offsets that fail iOS platform consistency checks.For the time being, use macOS system strip when cross-compiling from macOS -> iOS at
/usr/bin/strip
which should be available (unlike Linux -> macOS cross where this is not guaranteed to be available, partially why we are shippingllvm-objcopy
in the first place1) that shouldn't have this offset problem.Preferrably it should be addressed by syncing back the upstream llvm-objcopy fix, but this is opened in case the upstream fix takes some time to merge and be synced back.
Alternatives
strip
from PATH. However, that can regress iOS users if they have broken homebrew binutils strip in their PATH that take precedence over a "good" strip.llvm-objcopy
fixes in [llvm-objcopy] Apply encryptable offset to first segment, not section llvm/llvm-project#130517.Review and testing advice
I don't have access to either macOS or iOS platforms, and I can't really write a test for this. This will need to be tested manually.
r? @davidtwco (or reroll)
cc *-apple-ios target maintainers @badboy @deg4uss3r @madsmtm
try-job: dist-apple-various
try-job: dist-x86_64-apple
try-job: dist-aarch64-apple
Footnotes
https://github.com/rust-lang/rust/issues/131206 ↩