-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files #111384
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
These commits modify compiler targets. These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
This comment has been minimized.
This comment has been minimized.
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.
It would be best to also bump object in rustc_codegen_llvm
as otherwise rustc will be using two different versions of the object crate during compilation which could have unfortunate effects.
It is not necessary to change std's dependencies here because std needs backtrace to be updated first.
I have opened #111413 which does this but otherwise has some conflicting changes with your PR, so I'm quite happy to drop mine.
Blocked on #111413. |
@workingjubilee I did bump it here as well, happy to proceed either way. 👌 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
typo
(thanks for picking up my gist @bmisiak!) |
This comment was marked as resolved.
This comment was marked as resolved.
06b345f
to
9e89441
Compare
Rebased on top of #111413 and removed the dependency changes except for the bump of Two commits remain: the first one is a more basic support of injecting @rustbot label -S-blocked +S-waiting-on-review |
Thanks! |
…henkov Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files Hello. My first rustc PR! Issue rust-lang#106021 prevents Rust code from being linked into Mac Catalyst applications. Apple's LD has started requiring object files to contain version information about the platform they were built for, such as: * the "deployment target" (minimum supported OS version), * the SDK version * the type of the platform (macOS/iOS/catalyst/tvOS/watchOS all have a different number). This is currently only enforced when building for Mac Catalyst. Rust uses the `object` crate which added support for including this information starting with `0.31.0`. ~~I upgraded it along with `thorin-dwp` so that everything depends on 0.31. Apparently 0.31 [pulls in](gimli-rs/object#463) `ruzstd` due to a [new ELF standard](https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections) because its `compression` feature is enabled by thorin. If you find this objectionable, let me know what the best way to avoid pulling in those dependencies might be.~~ **(`object` upgraded in rust-lang#111413 I then added two commits: * The first one adds very basic, hard-coded support for calling `set_macho_build_version` for `-macabi` (Catalyst) targets, where it claims deployment target of Catalyst 14.0 and SDK of 16.2. * The second weaves the versioning through `rust_target::spec::TargetOptions`, so that we can stick to specifying all target-related info in one place. Kudos to `@ara4n` for writing [this gist](https://gist.github.com/ara4n/320a53ea768aba51afad4c9ed2168536).
@petrochenkov Hmmm I'm finding that my std fails to link for Catalyst when It chokes on
But works fine when #106925 removed the version from llvm_target because newer clang dropped support for the 13.0 catalyst target. I might add it back in, bumping it from 13.0 to 14.0. We do specify the target when building for iOS as well. |
@rustbot label -S-waiting-on-bors +S-waiting-on-review |
@bors r+ |
…henkov Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files Hello. My first rustc PR! Issue rust-lang#106021 prevents Rust code from being linked into Mac Catalyst applications. Apple's LD has started requiring object files to contain version information about the platform they were built for, such as: * the "deployment target" (minimum supported OS version), * the SDK version * the type of the platform (macOS/iOS/catalyst/tvOS/watchOS all have a different number). This is currently only enforced when building for Mac Catalyst. Rust uses the `object` crate which added support for including this information starting with `0.31.0`. ~~I upgraded it along with `thorin-dwp` so that everything depends on 0.31. Apparently 0.31 [pulls in](gimli-rs/object#463) `ruzstd` due to a [new ELF standard](https://maskray.me/blog/2022-09-09-zstd-compressed-debug-sections) because its `compression` feature is enabled by thorin. If you find this objectionable, let me know what the best way to avoid pulling in those dependencies might be.~~ **(`object` upgraded in rust-lang#111413 I then added two commits: * The first one adds very basic, hard-coded support for calling `set_macho_build_version` for `-macabi` (Catalyst) targets, where it claims deployment target of Catalyst 14.0 and SDK of 16.2. * The second weaves the versioning through `rust_target::spec::TargetOptions`, so that we can stick to specifying all target-related info in one place. Kudos to `@ara4n` for writing [this gist](https://gist.github.com/ara4n/320a53ea768aba51afad4c9ed2168536).
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#111384 (Fix linking Mac Catalyst by including LC_BUILD_VERSION in object files) - rust-lang#111899 (CGU cleanups) - rust-lang#111940 (Clarify safety concern of `io::Read::read` is only relevant in unsafe code) - rust-lang#111947 (Add test for RPIT defined with different hidden types with different substs) - rust-lang#111951 (Correct comment on privately uninhabited pattern.) Failed merges: - rust-lang#111954 (improve error message for calling a method on a raw pointer with an unknown pointee) r? `@ghost` `@rustbot` modify labels: rollup
Hello.
Issue #106021 prevents Rust code from being linked into Mac Catalyst applications. Apple's LD has started requiring object files to contain version information about the platform they were built for, such as:
This is currently only enforced when building for Mac Catalyst.
Rust uses the
object
crate which added support for including this information starting with0.31.0
.I upgraded it along withthorin-dwp
so that everything depends on 0.31.Apparently 0.31 pulls in
ruzstd
due to a new ELF standard because itscompression
feature is enabled by thorin. If you find this objectionable, let me know what the best way to avoid pulling in those dependencies might be.(
object
upgraded in #111413)I then added two commits:
set_macho_build_version
for-macabi
(Catalyst) targets, where it claims deployment target of Catalyst 14.0 and SDK of 16.2.rust_target::spec::TargetOptions
, so that we can stick to specifying all target-related info in one place.Kudos to @ara4n for writing this gist.