-
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
[WIP] Use /usr/bin/strip
on macOS -> iOS cross as a temporary mitigation
#138250
base: master
Are you sure you want to change the base?
Conversation
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.
@bors try |
⌛ Trying commit 908c5e4 with merge 06d1077d5ba6da9a0b3b6b84e6f919ec600dc1b6... |
[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).
@@ -1046,7 +1046,15 @@ fn link_natively( | |||
let strip = sess.opts.cg.strip; | |||
|
|||
if sess.target.is_like_osx { | |||
let stripcmd = "rust-objcopy"; | |||
let stripcmd = if sess.target.os == "ios" { |
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.
I'd prefer something like:
let stripcmd = if sess.target.os == "ios" { | |
let stripcmd = if cfg!(target_os = "macos") && sess.target.os != "macos" { |
To not further break cross-compilation from Linux->iOS (which is rare, but possible), and to also fix this on tvOS, watchOS and visionOS.
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.
Makes sense.
Mitigation for #138212. 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 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.Alternative mitigations
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.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
Footnotes
https://github.com/rust-lang/rust/issues/131206 ↩