add whether LinkerFlavor invokes the linker via a C/C++ compiler

This commit is contained in:
Rémy Rakic 2023-06-21 15:47:42 +00:00
parent 99605a0389
commit 5ea0f63733

View File

@ -367,6 +367,25 @@ pub fn uses_lld(self) -> bool {
| LinkerFlavor::Ptx => false, | LinkerFlavor::Ptx => false,
} }
} }
/// Returns whether the flavor calls the linker via a C/C++ compiler.
pub fn uses_cc(self) -> bool {
// Exhaustive match in case new flavors are added in the future.
match self {
LinkerFlavor::Gnu(Cc::Yes, _)
| LinkerFlavor::Darwin(Cc::Yes, _)
| LinkerFlavor::WasmLld(Cc::Yes)
| LinkerFlavor::Unix(Cc::Yes)
| LinkerFlavor::EmCc => true,
LinkerFlavor::Gnu(..)
| LinkerFlavor::Darwin(..)
| LinkerFlavor::WasmLld(_)
| LinkerFlavor::Msvc(_)
| LinkerFlavor::Unix(_)
| LinkerFlavor::Bpf
| LinkerFlavor::Ptx => false,
}
}
} }
macro_rules! linker_flavor_cli_impls { macro_rules! linker_flavor_cli_impls {