add whether LinkerFlavor uses lld

This commit is contained in:
Rémy Rakic 2023-06-21 15:46:50 +00:00
parent f4b80cacf9
commit 99605a0389

View File

@ -349,6 +349,24 @@ pub fn lld_flavor(self) -> LldFlavor {
pub fn is_gnu(self) -> bool { pub fn is_gnu(self) -> bool {
matches!(self, LinkerFlavor::Gnu(..)) matches!(self, LinkerFlavor::Gnu(..))
} }
/// Returns whether the flavor uses the `lld` linker.
pub fn uses_lld(self) -> bool {
// Exhaustive match in case new flavors are added in the future.
match self {
LinkerFlavor::Gnu(_, Lld::Yes)
| LinkerFlavor::Darwin(_, Lld::Yes)
| LinkerFlavor::WasmLld(..)
| LinkerFlavor::EmCc
| LinkerFlavor::Msvc(Lld::Yes) => true,
LinkerFlavor::Gnu(..)
| LinkerFlavor::Darwin(..)
| LinkerFlavor::Msvc(_)
| LinkerFlavor::Unix(_)
| LinkerFlavor::Bpf
| LinkerFlavor::Ptx => false,
}
}
} }
macro_rules! linker_flavor_cli_impls { macro_rules! linker_flavor_cli_impls {