-
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
linker: Report linker flavors incompatible with the current target #110807
Conversation
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
These commits modify compiler targets. |
r? rust-lang/compiler |
This comment was marked as resolved.
This comment was marked as resolved.
cc @lqd |
That seems fine under "common usage" and targets, right (even in cross- compilation cases) ? Maybe we can do a perf run just to exercize the PR with a few real world crates with build scripts and proc-macros, in case rustc-perf has more coverage there than our tests in practice. (I wouldn’t really expect issues to be found per se) Did we ever consider the bpf/ptx linker flavors stable ? Otherwise this LGTM. |
Yes, the only cases of breakage I can imagine are 1) wrong
I wouldn't expect any effect on performance, this is a cheap check that is performed once during compilation.
I guess no? |
This needs a couple of tests, one for the target compat check and another for the feature gates. |
1dd364e
to
4851f0b
Compare
Added tests. |
This comment was marked as resolved.
This comment was marked as resolved.
4851f0b
to
6675f46
Compare
// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf-linker --crate-type=rlib | ||
// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, `-Z unstable-options` flag | ||
// [bpf] needs-llvm-components: | ||
// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx-linker --crate-type=rlib |
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 don't think it matters but nvptx64-nvidia-cuda
is Tier 2, not Tier 3.
@bors r=lqd,wesleywiser |
📌 Commit 6675f46389bc931c0d73da75ed709846e2f76c53 has been approved by It is now in the queue for this repository. |
⌛ Testing commit 6675f46389bc931c0d73da75ed709846e2f76c53 with merge f74e273755395be9266f36badf49b933af48b1ed... |
Go through an intermediate pair of `cc`and `lld` hints instead of mapping CLI options to `LinkerFlavor` directly, and use the target's default linker flavor as a reference.
Previously they would be reported as link time errors about unknown linker options
6675f46
to
2f7328d
Compare
@bors r=lqd,wesleywiser |
…esleywiser linker: Report linker flavors incompatible with the current target The linker flavor is checked for target compatibility even if linker is never used (e.g. we are producing a rlib). If it causes trouble, we can move the check to `link.rs` so it will run if the linker (flavor) is actually used. And also feature gate explicitly specifying linker flavors for tier 3 targets. The next step is supporting all the internal linker flavors in user-visible interfaces (command line and json).
looks like this broke dist-x86_64-linux? #112092 (comment) |
Nevermind, it was innocent: #112095 (comment) @bors r=lqd,wesleywiser |
☀️ Test successful - checks-actions |
Finished benchmarking commit (9af3865): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 643.718s -> 644.991s (0.20%) |
The linker flavor is checked for target compatibility even if linker is never used (e.g. we are producing a rlib).
If it causes trouble, we can move the check to
link.rs
so it will run if the linker (flavor) is actually used.And also feature gate explicitly specifying linker flavors for tier 3 targets.
The next step is supporting all the internal linker flavors in user-visible interfaces (command line and json).