-
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 flags when using clang as linker for Fuchsia #99500
Conversation
r? @fee1-dead (rust-highfive has picked a reviewer for you, use r? to override) |
|
r? @rust-lang/compiler |
There's no logic in LLD for locating |
This comment was marked as outdated.
This comment was marked as outdated.
oops wrong PR :D |
Then it seems we should include This doesn't seem specific to Fuchsia, but I can't find any general handling of it. Is this because other platforms just aren't using lld yet? @petrochenkov do you know? |
r? @petrochenkov |
Based on the above discussion I don't think we should merge this as-is (since it would break linking with lld). |
The code that decides whether to link startup objects or not is |
Ok, we are missing some target spec infra here, so the best thing you can do right now is --- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -2086,7 +2086,9 @@ fn add_order_independent_options(
// Make the binary compatible with data execution prevention schemes.
cmd.add_no_exec();
- if crt_objects_fallback {
+ // FIXME: we are currently missing some infra here (per-linker-flavor CRT objects),
+ // so Fuchsia has to be special-cased.
+ if crt_objects_fallback && !(sess.target.os == "fuchsia" && flavor == LinkerFlavor::Gcc) {
cmd.no_crt_objects();
} And the same exception for |
@petrochenkov We aren't currently using crt_objects_fallback, do you mean we should switch to using that? It seems like your original idea to add a |
No, no, I reread the code and realized that the "CRT object fallback" is a very outdated naming at this point, the flag really means "whether self-contained linking mode is enabled" (as in |
rustc_target: Update some old naming around self contained linking The "fallback" naming pre-dates introduction of `-Clink-self-contained`. Noticed when reviewing rust-lang#99500. This PR doesn't break any json target spec, but supporting per-linker-flavor startup objects needed by rust-lang#99500 will break them, so maybe next time I'll remove the compatibility names.
122b5ce
to
5564eb1
Compare
Okay, I've updated this to just remove flags when linking with clang. We don't use the crt_fallback for Fuchsia at all so we don't need to modify that path. @rustbot ready |
@bors r+ |
📌 Commit 5472b38a4b5f4d26ca49faf33453ad9f2e341fc1 has been approved by It is now in the queue for this repository. |
This comment has been minimized.
This comment has been minimized.
Don't add C runtime or set dynamic linker when linking with clang for Fuchsia. Clang already does this for us.
@bors r=petrochenkov |
…iaskrgr Rollup of 13 pull requests Successful merges: - rust-lang#93896 (rustdoc: make item-infos dimmer on dark theme) - rust-lang#99337 (rustdoc: simplify highlight.rs) - rust-lang#99421 (add crt-static for android) - rust-lang#99500 (Fix flags when using clang as linker for Fuchsia) - rust-lang#99511 (make raw_eq precondition more restrictive) - rust-lang#99992 (Add `x.sh` and `x.ps1` shell scripts) - rust-lang#100112 (Fix test: chunks_mut_are_send_and_sync) - rust-lang#100203 (provide correct size hint for unsupported platform `CommandArgs`) - rust-lang#100307 (Fix rust-lang#96847) - rust-lang#100350 (Stringify non-shorthand visibility correctly) - rust-lang#100374 (Improve crate selection on rustdoc search results page) - rust-lang#100392 (Simplify visitors) - rust-lang#100418 (Add stability attributes to BacktraceStatus variants) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
rustc_target: Update some old naming around self contained linking The "fallback" naming pre-dates introduction of `-Clink-self-contained`. Noticed when reviewing rust-lang#99500. This PR doesn't break any json target spec, but supporting per-linker-flavor startup objects needed by rust-lang#99500 will break them, so maybe next time I'll remove the compatibility names.
rustc_target: Update some old naming around self contained linking The "fallback" naming pre-dates introduction of `-Clink-self-contained`. Noticed when reviewing rust-lang#99500. This PR doesn't break any json target spec, but supporting per-linker-flavor startup objects needed by rust-lang#99500 will break them, so maybe next time I'll remove the compatibility names.
Don't add C runtime or set dynamic linker when linking with clang for
Fuchsia. Clang already does this for us.