-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets #60788
default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets #60788
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@froydnj you'll have to update two tests @rust-lang/compiler who's more familiar with the state of the Darwin/MacOs arch to review this? The change itself looks good to me. |
Over in rust-lang#60378, we made `rustc` switch LLVM target triples dynamically based on the `MACOSX_DEPLOYMENT_TARGET` environment variable. This change was made to align with `clang`'s behavior, and therefore make cross-language LTO feasible on OS X. Otherwise, `rustc` would produce LLVM bitcode files with a target triple of `x86_64-apple-darwin`, `clang` would produce LLVM bitcode files with a target triple of `x86_64-apple-macosx$VERSION`, and the linker would complain. This change worked fine, except for one corner case: if you didn't have `MACOSX_DEPLOYMENT_TARGET` set, and you wanted to do LTO on just Rust code, you'd get warning messages similar to: ``` warning: Linking two modules of different target triples: ' is 'x86_64-apple-macosx10.7.0' whereas 'main.7rcbfp3g-cgu.4' is 'x86_64-apple-darwin' ``` This message occurs because libstd is compiled with `MACOSX_DEPLOYMENT_TARGET` set to 10.7. The LLVM bitcode distributed in libstd's rlibs, then, is tagged with the target triple of `x86_64-apple-macosx10.7.0`, while the bitcode `rustc` produces for "user" code is tagged with the target triple of `x86_64-apple-darwin`. It's not good to have LTO on just Rust code (probably much more common than cross-language LTO) warn by default. These warnings also break Cargo's testsuite. This change defaults to acting as though `MACOSX_DEPLOYMENT_TARGET` was set to 10.7. "user" code will then be given a target triple that is equivalent to the target triple libstd bitcode is already using. The above warning will therefore go away. `rustc` already assumes that compiling without `MACOSX_DEPLOYMENT_TARGET` means that we're compiling for a target compatible with OS X 10.7 (e.g. that things like TLS work properly). So this change is really just making things conform more closely to the status quo. (It's also worth noting that before and after this patch, compiling with `MACOSX_DEPLOYMENT_TARGET` set to, say, 10.9, works just fine: target triples with an "apple" version ignore OS versions when checking compatibility, so bitcode with a `x86_64-apple-macosx10.7.0` triple works just fine with bitcode with a `x86_64-apple-macosx10.9.0` triple.)
3127dce
to
7e94f9c
Compare
Doh, I thought about updating those tests, and then completely forgot to do it before pushing the PR! Expectation lines for the tests updated. |
@bors r+ rollup |
📌 Commit 7e94f9c has been approved by |
🌲 The tree is currently closed for pull requests below priority 500, this pull request will be tested once the tree is reopened |
…followup, r=estebank default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets Over in rust-lang#60378, we made `rustc` switch LLVM target triples dynamically based on the `MACOSX_DEPLOYMENT_TARGET` environment variable. This change was made to align with `clang`'s behavior, and therefore make cross-language LTO feasible on OS X. Otherwise, `rustc` would produce LLVM bitcode files with a target triple of `x86_64-apple-darwin`, `clang` would produce LLVM bitcode files with a target triple of `x86_64-apple-macosx$VERSION`, and the linker would complain. This change worked fine, except for one corner case: if you didn't have `MACOSX_DEPLOYMENT_TARGET` set, and you wanted to do LTO on just Rust code, you'd get warning messages similar to: ``` warning: Linking two modules of different target triples: ' is 'x86_64-apple-macosx10.7.0' whereas 'main.7rcbfp3g-cgu.4' is 'x86_64-apple-darwin' ``` This message occurs because libstd is compiled with `MACOSX_DEPLOYMENT_TARGET` set to 10.7. The LLVM bitcode distributed in libstd's rlibs, then, is tagged with the target triple of `x86_64-apple-macosx10.7.0`, while the bitcode `rustc` produces for "user" code is tagged with the target triple of `x86_64-apple-darwin`. It's not good to have LTO on just Rust code (probably much more common than cross-language LTO) warn by default. These warnings also break Cargo's testsuite. This change defaults to acting as though `MACOSX_DEPLOYMENT_TARGET` was set to 10.7. "user" code will then be given a target triple that is equivalent to the target triple libstd bitcode is already using. The above warning will therefore go away. `rustc` already assumes that compiling without `MACOSX_DEPLOYMENT_TARGET` means that we're compiling for a target compatible with OS X 10.7 (e.g. that things like TLS work properly). So this change is really just making things conform more closely to the status quo. (It's also worth noting that before and after this patch, compiling with `MACOSX_DEPLOYMENT_TARGET` set to, say, 10.9, works just fine: target triples with an "apple" version ignore OS versions when checking compatibility, so bitcode with a `x86_64-apple-macosx10.7.0` triple works just fine with bitcode with a `x86_64-apple-macosx10.9.0` triple.)
Rollup of 9 pull requests Successful merges: - #60130 (Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators) - #60443 (as_ptr returns a read-only pointer) - #60444 (forego caching for all participants in cycles, apart from root node) - #60719 (Allow subdirectories to be tested by x.py test) - #60780 (fix Miri) - #60788 (default to $ARCH-apple-macosx10.7.0 LLVM triple for darwin targets) - #60799 (Allow late-bound regions in existential types) - #60808 (Improve the "must use" lint for `Future`) - #60819 (submodules: update clippy from 3710ec5 to ad3269c) Failed merges: r? @ghost
This breaks https://github.com/CraneStation/target-lexicon/ (https://travis-ci.org/bjorn3/rustc_codegen_cranelift/jobs/532621583#L358) and other crates parsing the target name cargo passes in the cc @sunfishcode |
@bjorn3 can you expand on the breakage? This is intended to be a purely internal change having no user-visible effects in terms of target strings showing up. |
Before this PR cargo filled |
Can you provide a standalone example which exhibits the issue? |
Seems like I misinterpreted the error. This issue is not during compilation of |
beta-nominating as coupled with PR #60378 |
discussed at T-compiler meeting. Declining to backport: this landed only very recently, and the beta-to-stable promotion is imminent, which means that this patch would be getting very little time in the wild for evaluation prior to hypothetically ending up in stable. That, coupled with the facts that 1. there is at least some evidence that this caused problem in the wild, and 2. we believe the FF team is able to use beta rather than stable for their bootstrapping, if necessary, leads us to decide that the risk of a backport here is not justified. |
Over in #60378, we made
rustc
switch LLVM target triples dynamicallybased on the
MACOSX_DEPLOYMENT_TARGET
environment variable. Thischange was made to align with
clang
's behavior, and therefore makecross-language LTO feasible on OS X. Otherwise,
rustc
would produceLLVM bitcode files with a target triple of
x86_64-apple-darwin
,clang
would produce LLVM bitcode files with a target triple ofx86_64-apple-macosx$VERSION
, and the linker would complain.This change worked fine, except for one corner case: if you didn't have
MACOSX_DEPLOYMENT_TARGET
set, and you wanted to do LTO on just Rustcode, you'd get warning messages similar to:
This message occurs because libstd is compiled with
MACOSX_DEPLOYMENT_TARGET
set to 10.7. The LLVM bitcode distributed inlibstd's rlibs, then, is tagged with the target triple of
x86_64-apple-macosx10.7.0
, while the bitcoderustc
produces for"user" code is tagged with the target triple of
x86_64-apple-darwin
.It's not good to have LTO on just Rust code (probably much more common
than cross-language LTO) warn by default. These warnings also break
Cargo's testsuite.
This change defaults to acting as though
MACOSX_DEPLOYMENT_TARGET
wasset to 10.7. "user" code will then be given a target triple that is
equivalent to the target triple libstd bitcode is already using. The
above warning will therefore go away.
rustc
already assumes that compiling withoutMACOSX_DEPLOYMENT_TARGET
means that we're compiling for a targetcompatible with OS X 10.7 (e.g. that things like TLS work properly). So
this change is really just making things conform more closely to the
status quo.
(It's also worth noting that before and after this patch, compiling with
MACOSX_DEPLOYMENT_TARGET
set to, say, 10.9, works just fine: targettriples with an "apple" version ignore OS versions when checking
compatibility, so bitcode with a
x86_64-apple-macosx10.7.0
triple works justfine with bitcode with a
x86_64-apple-macosx10.9.0
triple.)