Skip to content

Honor linker flavor - #270

Merged
Shnatsel merged 5 commits into
masterfrom
honor-linker-flavor-flag
Oct 2, 2026
Merged

Shnatsel merged 5 commits into
masterfrom
honor-linker-flavor-flag

Conversation

@Shnatsel

Copy link
Copy Markdown
Member
  1. Honor the -C linker-flavor= flag if passed explicitly
  2. Query the default linker flavor for a given platform from rustc, where possible. This functionality is unstable and may break, but the breakage will only affect uncommon embedded platforms.

@jonathanpallant please try this and let me know if it works for you

.find(|l| l.starts_with("host: "))
.map(|l| l[6..].to_string())
.expect("Failed to parse rustc output to determine the current platform. Please report this bug!")
}

@bjorn3 bjorn3 Sep 30, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

rustc --print host-tuple is simpler, though I don't know if it was available on your MSRV already.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I want to support older rustc versions, so I aped this from Cargo and it never broke so I never changed it.

@jonathanpallant

Copy link
Copy Markdown

This works for me. But I feel like there should be a better way of getting this information out of rustc than using a flag hidden with -Z unstable-options for a reason. Maybe it's worth asking on Zulip?

Comment thread cargo-auditable/src/target_info.rs Outdated
@Shnatsel

Copy link
Copy Markdown
Member Author

I asked on the community discord and the response I got is that maybe adding a new --print flag wouldn't be that bad but it's still going to be nightly-only for a good while so I don't really see the point of doing that over a nightly-only flag that is already there.

@Shnatsel
Shnatsel merged commit 4213b25 into master Oct 2, 2026
11 checks passed
@Shnatsel
Shnatsel deleted the honor-linker-flavor-flag branch October 2, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants