Fix linker detection for clang with prefix

This commit is contained in:
Taiki Endo 2023-03-15 13:30:45 +09:00
parent 1716932743
commit 86a5e3632c

View File

@ -1199,7 +1199,7 @@ fn infer_from(
.and_then(|(lhs, rhs)| rhs.chars().all(char::is_numeric).then_some(lhs))
.unwrap_or(stem);
// GCC can have an optional target prefix.
// GCC/Clang can have an optional target prefix.
let flavor = if stem == "emcc" {
LinkerFlavor::EmCc
} else if stem == "gcc"
@ -1207,7 +1207,9 @@ fn infer_from(
|| stem == "g++"
|| stem.ends_with("-g++")
|| stem == "clang"
|| stem.ends_with("-clang")
|| stem == "clang++"
|| stem.ends_with("-clang++")
{
LinkerFlavor::from_cli(LinkerFlavorCli::Gcc, &sess.target)
} else if stem == "wasm-ld" || stem.ends_with("-wasm-ld") {