You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: If linking with clang works, linking with clang-13 or clang-14 etc. should also work.
Instead, this happened: Linking failed with clang-13. It looks like the detection of the linker failed and -Wl, was not added in some flags rust added.
…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).
Fixesrust-lang#106454
I tried this code:
main.rs:
compilation without specifying a linker works (uses rust-lld):
cargo +nightly rustc --target=aarch64-unknown-none -- -Clink-arg=-nostdlib Finished dev [unoptimized + debuginfo] target(s) in 0.08s
compilation while specifying clang as a linker-driver works:
CARGO_TARGET_AARCH64_UNKNOWN_NONE_LINKER=/usr/bin/clang cargo +nightly rustc --target=aarch64-unknown-none -- -Clink-arg=--target=aarch64-linux-gnu -Clink-arg=-fuse-ld=lld -Clink-arg=-nostdlib Finished dev [unoptimized + debuginfo] target(s) in 0.12s
linking with
clang-13
(or any otherclang-xx
version) fails:I expected to see this happen: If linking with
clang
works, linking withclang-13
orclang-14
etc. should also work.Instead, this happened: Linking failed with
clang-13
. It looks like the detection of the linker failed and-Wl,
was not added in some flags rust added.Meta
Rust 1.65 and latest nigthly
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: