-
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
--target should ignore the machine part of the triplet in most cases #33147
Comments
cc @brson, do you recall if there was any specific reason for doing exact target matching at some point in the past? I believe LLVM has support for all of this under the hood, so it should be relatively easy to just follow what clang does here. |
From the man pages:
This matches the behaviour of LLVM. To me it seems like Perhaps it would make sense to not allow target files to be for That being said, first time hearing about |
We might also want to consider the behaviour of I was originally planning to wait and fix the float code on x87, but as this topic is coming up independently, I started a thread in the internals forum as suggested by @nagisa. |
I tried passing a bunch of varying options to config.sub and none of them omit the I also tried some intentionally pathological cases like Thus, my personal stance does not change and I feel rustc to be very reasonable by having users specify the exact quadruple.
I don’t remember suggesting anything of the sort. |
I've heard this complaint recently. cc rust-lang/rfcs#1763. |
I think this is a bug and target specs should by default ignore the vendor string. I don't know offhand the impact on various Rust tooling, but it's not just rustc that would need to change. |
I don't think trying to have rustc assign meaning to rust target strings is a good idea. Unconditionally ignoring the vendor will certainly break people who are using that part of the string to differentiate similar, but slightly different configurations (for example, in meta-rust the vendor is the distro name, and generally serves to indicate that it has a different set of linker flags to use a sysroot). To ensure that our targets are fully configurable, we'd ideally have all the Right now, we've got a simple 1-to-1 mapping for target strings to configuration. Trying to parse the target string to treat one part of it differently gets rid of that and increases complexity without much benefit. Now, that said: it could make sense to allow the build process for rust understand that if someone says "give me x86_64-pc-linux-gnu" without anything additional specified, that the person is asking for something very much like the builtin |
Note that vendor is used for differentiating between OS platforms/libc-types. (eg, "gnu", "uclibc", ...) |
The "gnu" part is the ABI; the vendor is "unknown". |
Triage; no changes I'm aware of. |
This is now an annoyance when using
I think this is technically a bug in |
I see that the target mismatch warnings were mentioned back in 2018 when |
Causes warnings at link time due to C++ and Rust using different target strings. See rust-lang/rust#33147 for more details.
build: Enable cross-language ThinLTO Causes warnings at link time due to C++ and Rust using different target strings. These warnings do not break CI, because while we require `-Werror` to build on Linux, that only affects compilation, not linking. See rust-lang/rust#33147 for more details.
Causes warnings at link time due to C++ and Rust using different target strings. See rust-lang/rust#33147 for more details.
build: Enable cross-language ThinLTO Causes warnings at link time due to C++ and Rust using different target strings. These warnings do not break CI, because while we require `-Werror` to build on Linux, that only affects compilation, not linking. See rust-lang/rust#33147 for more details.
Causes warnings at link time due to C++ and Rust using different target strings. See rust-lang/rust#33147 for more details.
Currently, rustc accepts a limited set of --target values. Those match some of the values one can get out of the typical
config.guess
, but for most platforms, the machine/manufacturer part of the target triplet should be ignored, or allowed to be omitted. (the output of config-guess is of the formCPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
orCPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
)For example, the linux x86_64 target for rustc is
--target=x86_64-unknown-linux-gnu
.Some time ago,
config.guess
would have returned that. Nowadays, it returnsx86_64-pc-linux-gnu
.clang accepts both, as well as the shorter form:
--target=x86_64-linux-gnu
(in fact, it's very lax,--target=x86_64-foo
works too).A typical cross GCC toolchain will come as
x86_64-linux-gnu-gcc
too.The text was updated successfully, but these errors were encountered: