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