Fix linker detection for linker (drivers) with a version postfix (e.g. clang-12 instead of clang) by jschwe · Pull Request #106489 · rust-lang/rust
rustbot
added
S-waiting-on-review
labels
Jan 5, 2023
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Jan 9, 2023
bors
added
S-waiting-on-author
and removed S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.labels
Jan 9, 2023
rustbot
added
S-waiting-on-author
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Jan 13, 2023Linker drivers such as gcc, clang or lld often have a version postfix, e.g clang-12. The previous logic would not account for this and would fall back to guessing the linker flavor to be the default linker flavor for the target, which causes linker errors when this is not the case. By accounting for the possible version postfix and also considering g++ and clang++, we considerably reduce the amount of times the fallback guess has to be used. To simplify matching check for a version postfix and match against the linker stem without any version postfix. In contrast to gcc, clang supports all architectures in one binary. This means there are no variants like `aarch64-linux-gnu-clang` and there is no need to check for `-clang` variants.
rustbot
added
S-waiting-on-review
and removed S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.labels
Jan 13, 2023
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Jan 13, 2023matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Jan 13, 2023…rochenkov Fix linker detection for linker (drivers) with a version postfix (e.g. clang-12 instead of clang) Linker (drivers) such as clang / gcc or lld often have a version postfix matching the regex "-\d+$". Previously, linker detection did not account for the possible version postfix and the fallback value was used, which can cause linker errors due to wrong arguments. Also remove the check for `-clang`, since there are no architecture specific variants of clang (to my knowledge). Fixes rust-lang#106454
bors added a commit to rust-lang-ci/rust that referenced this pull request
Jan 13, 2023…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#104645 (Add log-backtrace option to show backtraces along with logging) - rust-lang#106465 (Bump `IMPLIED_BOUNDS_ENTAILMENT` to Deny + ReportNow) - rust-lang#106489 (Fix linker detection for linker (drivers) with a version postfix (e.g. clang-12 instead of clang)) - rust-lang#106585 (When suggesting writing a fully qualified path probe for appropriate types) - rust-lang#106641 (Provide help on closures capturing self causing borrow checker errors) - rust-lang#106678 (Warn when using panic-strategy abort for proc-macro crates) - rust-lang#106701 (Fix `mpsc::SyncSender` spinning behavior) - rust-lang#106793 (Normalize test output more thoroughly) - rust-lang#106797 (riscv: Fix ELF header flags) - rust-lang#106813 (Remove redundant session field) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
jschwe
deleted the
fix_linker_detection
branch
taiki-e added a commit to taiki-e/setup-cross-toolchain-action that referenced this pull request
Mar 12, 2023Rust 1.68 (rust-lang/rust#106489) broke this: ``` = note: clang-15: error: unsupported option '--export' clang-15: error: unsupported option '--stack-first' clang-15: error: unsupported option '--allow-undefined' clang-15: error: unsupported option '--fatal-warnings' clang-15: error: unsupported option '--no-demangle' clang-15: error: unsupported option '--gc-sections' clang-15: error: unknown argument: '-flavor' clang-15: error: no such file or directory: 'wasm' clang-15: error: no such file or directory: '__main_void' ```
taiki-e added a commit to taiki-e/rust-cross-toolchain that referenced this pull request
Mar 12, 2023Rust 1.68 (rust-lang/rust#106489) broke this: ``` = note: clang-15: error: unsupported option '--export' clang-15: error: unsupported option '--stack-first' clang-15: error: unsupported option '--allow-undefined' clang-15: error: unsupported option '--fatal-warnings' clang-15: error: unsupported option '--no-demangle' clang-15: error: unsupported option '--gc-sections' clang-15: error: unknown argument: '-flavor' clang-15: error: no such file or directory: 'wasm' clang-15: error: no such file or directory: '__main_void' ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters