-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Apple: Do not specify an SDK version in rlib
object files
#131016
Conversation
This PR modifies cc @jieyouxu These commits modify compiler targets. |
This is unnecessary, since it ends up being overwritten when linking anyhow, and it feels wrong to embed some arbitrary SDK version in here.
7a6229b
to
6b06ceb
Compare
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.
Thanks, the changes look reasonable to me but I'll wait for other apple target maintainers to double-check. I have one question regarding the test.
// Test with clang | ||
let file_name = format!("foo_cc{file_ext}"); | ||
rustc() | ||
.target(target()) | ||
.crate_type("bin") | ||
.arg("-Clinker-flavor=gcc") |
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.
Question: is this comment or arg accurate, the comment says clang, but linker-flavor is gcc?
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.
The comment is mostly accurate, it tests with cc
, which is basically always Clang on Apple platforms, it's just how the linker-flavor
option works.
Should this get relnotes? Even if it doesn't technically change how object file SDK version is treated if I understand this correctly. |
I'll tag @thomcc as well then.
This is only used inside |
rlib
object files
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.
Nice PR, everything looks fine to me and more test coverage too.
I did indeed comment on the original values because Magic Numbers are odd, but it was harmless in removing a linker warning with no actual cost beyond a strangeness factor. I didn't dig in very far (should have looked at LLVM like you did). Since it turns out the SDK version is actually optional at this stage of linking, there doesn't appear to be any good reason left for rustc
to carry that added strange.
Thanks @BlackHoleFox . In that case, @bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#130863 (Relax a debug assertion for dyn principal *equality* in codegen) - rust-lang#131016 (Apple: Do not specify an SDK version in `rlib` object files) - rust-lang#131140 (Handle `rustc_hir_analysis` cases of `potential_query_instability` lint) - rust-lang#131141 (mpmc doctest: make sure main thread waits for child threads) - rust-lang#131150 (only query `params_in_repr` if def kind is adt) - rust-lang#131151 (Replace zero-width whitespace with a visible `\` in the PR template) - rust-lang#131152 (Improve const traits diagnostics for new desugaring) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#131016 - madsmtm:no-sdk-version-in-object, r=jieyouxu Apple: Do not specify an SDK version in `rlib` object files This was added in rust-lang#114114, but is unnecessary, since it ends up being overwritten when linking anyhow, and it feels wrong to embed some arbitrary SDK version in here. The object files produced by LLVM also do not set this, and the tooling shows `n/a` when it's `0`, so it seems to genuinely be optional in object files. I've also added a test for the different places the SDK version shows up, and documented a bit more in the code how SDK versions work. See rust-lang#129432 for the bigger picture. Tested with (excludes the same few targets as in rust-lang#130435): ```console ./x test tests/run-make/apple-sdk-version --target aarch64-apple-darwin,aarch64-apple-ios,aarch64-apple-ios-macabi,aarch64-apple-ios-sim,aarch64-apple-tvos,aarch64-apple-tvos-sim,aarch64-apple-visionos,aarch64-apple-visionos-sim,aarch64-apple-watchos,aarch64-apple-watchos-sim,arm64_32-apple-watchos,armv7k-apple-watchos,armv7s-apple-ios,x86_64-apple-darwin,x86_64-apple-ios,x86_64-apple-ios-macabi,x86_64-apple-tvos,x86_64-apple-watchos-sim,x86_64h-apple-darwin IPHONEOS_DEPLOYMENT_TARGET=10.0 ./x test tests/run-make/apple-sdk-version --target=i386-apple-ios ``` CC `@BlackHoleFox,` you [originally commented on these values](rust-lang#114114 (comment)). `@rustbot` label O-apple
This was added in #114114, but is unnecessary, since it ends up being overwritten when linking anyhow, and it feels wrong to embed some arbitrary SDK version in here. The object files produced by LLVM also do not set this, and the tooling shows
n/a
when it's0
, so it seems to genuinely be optional in object files.I've also added a test for the different places the SDK version shows up, and documented a bit more in the code how SDK versions work.
See #129432 for the bigger picture.
Tested with (excludes the same few targets as in #130435):
CC @BlackHoleFox, you originally commented on these values.
@rustbot label O-apple