Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use RUSTC_LINKER's prefix as last resort for prefix_for_target(). #685

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

dot-asm
Copy link
Contributor

@dot-asm dot-asm commented Jun 5, 2022

User-provided cross-linker is a working cross-compiler with a perfectly usable prefix. Usable in the prefix_for_target() context that is. One can wonder if it's possible to even remove the majority of the mapping table... (I write "majority" because *-windows-gnu [and no-std?] users are excused from configuring cross-linker.) Potentially fixes #666 and #637. [Possibly even #654. To help #654 one would have to remove the musl mappings. So that the fallback is actually fallen on.]

@dot-asm dot-asm force-pushed the linker-as-prefix branch from 55c8697 to 9f86471 Compare July 11, 2022 08:14
Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very reasonable to me.

// Put aside RUSTC_LINKER's prefix to be used as last resort
let rustc_linker = self.getenv("RUSTC_LINKER").unwrap_or("".to_string());
// let linker_prefix = rustc_linker.strip_suffix("-gcc"); // >=1.45.0
let linker_prefix = if rustc_linker.len() > 4 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably implement this as if rustc_linker.ends_with("-gcc") { ... }, but I don't really think this needs to be done here (I probably will be making a case for bumping cc-rs's MSRV in coherence with whatever we decide in rust-lang/libs-team#72, so I don't think this needs to be bad for that long).

@thomcc thomcc merged commit 0f28004 into rust-lang:main Oct 26, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants