Simplify implementation of -Z gcc-ld

- The logic is now unified for all targets (wasm targets should also be supported now)
- Additional "symlink" files like `ld64` are eliminated
- lld-wrapper is used for propagating the correct lld flavor
- Cleanup "unwrap or exit" logic in lld-wrapper
This commit is contained in:
Vadim Petrochenkov 2022-05-24 23:29:15 +03:00
parent 1b5e1215ef
commit 2984bf674f
8 changed files with 71 additions and 122 deletions

View file

@ -108,6 +108,15 @@ pub enum LldFlavor {
}
impl LldFlavor {
pub fn as_str(&self) -> &'static str {
match self {
LldFlavor::Wasm => "wasm",
LldFlavor::Ld64 => "darwin",
LldFlavor::Ld => "gnu",
LldFlavor::Link => "link",
}
}
fn from_str(s: &str) -> Option<Self> {
Some(match s {
"darwin" => LldFlavor::Ld64,
@ -121,13 +130,7 @@ impl LldFlavor {
impl ToJson for LldFlavor {
fn to_json(&self) -> Json {
match *self {
LldFlavor::Ld64 => "darwin",
LldFlavor::Ld => "gnu",
LldFlavor::Link => "link",
LldFlavor::Wasm => "wasm",
}
.to_json()
self.as_str().to_json()
}
}