diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-05-24 23:29:15 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-05-25 23:55:22 +0300 |
| commit | 2984bf674f5f1839c19002f4fd032eacc98596c9 (patch) | |
| tree | 4482219c0cc9ac5d8ab5c4704328c0a5019cbf2a /compiler/rustc_target/src | |
| parent | 1b5e1215efa47cf4d78a945c7be1c04cda4f57d4 (diff) | |
| download | rust-2984bf674f5f1839c19002f4fd032eacc98596c9.tar.gz rust-2984bf674f5f1839c19002f4fd032eacc98596c9.zip | |
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
Diffstat (limited to 'compiler/rustc_target/src')
| -rw-r--r-- | compiler/rustc_target/src/spec/mod.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 832eeec3e8b..6dd245b047c 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -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() } } |
