about summary refs log tree commit diff
diff options
context:
space:
mode:
authordaxpedda <daxpedda@gmail.com>2023-12-13 19:36:17 +0100
committerdaxpedda <daxpedda@gmail.com>2024-03-10 09:00:09 +0100
commit9e2c65893dcf5e8da2fc7cd25af94ba3233e9c51 (patch)
tree9d36a370fa867f8c00f878c5edaa36b81d82c1cd
parentf09c19ac3a514a0f74e25443f48898f80bde561c (diff)
downloadrust-9e2c65893dcf5e8da2fc7cd25af94ba3233e9c51.tar.gz
rust-9e2c65893dcf5e8da2fc7cd25af94ba3233e9c51.zip
Remove `TargetOptions::default_adjusted_cabi`
Co-Authored-By: Ralf Jung <330628+RalfJung@users.noreply.github.com>
-rw-r--r--compiler/rustc_target/src/spec/mod.rs27
-rw-r--r--compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs11
2 files changed, 4 insertions, 34 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index c42e818167c..578faf3f935 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -37,7 +37,7 @@
 use crate::abi::call::Conv;
 use crate::abi::{Endian, Integer, Size, TargetDataLayout, TargetDataLayoutErrors};
 use crate::json::{Json, ToJson};
-use crate::spec::abi::{lookup as lookup_abi, Abi};
+use crate::spec::abi::Abi;
 use crate::spec::crt_objects::CrtObjects;
 use rustc_fs_util::try_canonicalize;
 use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
@@ -2167,9 +2167,6 @@ pub struct TargetOptions {
     /// distributed with the target, the sanitizer should still appear in this list for the target.
     pub supported_sanitizers: SanitizerSet,
 
-    /// If present it's a default value to use for adjusting the C ABI.
-    pub default_adjusted_cabi: Option<Abi>,
-
     /// Minimum number of bits in #[repr(C)] enum. Defaults to the size of c_int
     pub c_enum_min_bits: Option<u64>,
 
@@ -2399,7 +2396,6 @@ impl Default for TargetOptions {
             // `Off` is supported by default, but targets can remove this manually, e.g. Windows.
             supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
             supported_sanitizers: SanitizerSet::empty(),
-            default_adjusted_cabi: None,
             c_enum_min_bits: None,
             generate_arange_section: true,
             supports_stack_protector: true,
@@ -2438,11 +2434,11 @@ impl Target {
             Abi::C { .. } => {
                 if self.arch == "wasm32"
                     && self.os == "unknown"
-                    && cx.wasm_c_abi_opt() == WasmCAbi::Spec
+                    && cx.wasm_c_abi_opt() == WasmCAbi::Legacy
                 {
-                    abi
+                    Abi::Wasm
                 } else {
-                    self.default_adjusted_cabi.unwrap_or(abi)
+                    abi
                 }
             }
 
@@ -2967,16 +2963,6 @@ impl Target {
                     }
                 }
             } );
-            ($key_name:ident, Option<Abi>) => ( {
-                let name = (stringify!($key_name)).replace("_", "-");
-                obj.remove(&name).and_then(|o| o.as_str().and_then(|s| {
-                    match lookup_abi(s) {
-                        Ok(abi) => base.$key_name = Some(abi),
-                        _ => return Some(Err(format!("'{}' is not a valid value for abi", s))),
-                    }
-                    Some(Ok(()))
-                })).unwrap_or(Ok(()))
-            } );
             ($key_name:ident, TargetFamilies) => ( {
                 if let Some(value) = obj.remove("target-family") {
                     if let Some(v) = value.as_array() {
@@ -3126,7 +3112,6 @@ impl Target {
         key!(split_debuginfo, SplitDebuginfo)?;
         key!(supported_split_debuginfo, fallible_list)?;
         key!(supported_sanitizers, SanitizerSet)?;
-        key!(default_adjusted_cabi, Option<Abi>)?;
         key!(generate_arange_section, bool);
         key!(supports_stack_protector, bool);
         key!(entry_name);
@@ -3390,10 +3375,6 @@ impl ToJson for Target {
         target_option_val!(entry_abi);
         target_option_val!(supports_xray);
 
-        if let Some(abi) = self.default_adjusted_cabi {
-            d.insert("default-adjusted-cabi".into(), Abi::name(abi).to_json());
-        }
-
         // Serializing `-Clink-self-contained` needs a dynamic key to support the
         // backwards-compatible variants.
         d.insert(self.link_self_contained.json_key().into(), self.link_self_contained.to_json());
diff --git a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
index 94ded57d2f0..7db4d8aca56 100644
--- a/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
+++ b/compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
@@ -10,23 +10,12 @@
 //! This target is more or less managed by the Rust and WebAssembly Working
 //! Group nowadays at <https://github.com/rustwasm>.
 
-use crate::spec::abi::Abi;
 use crate::spec::{base, Cc, LinkerFlavor, Target};
 
 pub fn target() -> Target {
     let mut options = base::wasm::options();
     options.os = "unknown".into();
 
-    // This is a default for backwards-compatibility with the original
-    // definition of this target oh-so-long-ago. Once the "wasm" ABI is
-    // stable and the wasm-bindgen project has switched to using it then there's
-    // no need for this and it can be removed.
-    //
-    // Currently this is the reason that this target's ABI is mismatched with
-    // clang's ABI. This means that, in the limit, you can't merge C and Rust
-    // code on this target due to this ABI mismatch.
-    options.default_adjusted_cabi = Some(Abi::Wasm);
-
     options.add_pre_link_args(
         LinkerFlavor::WasmLld(Cc::No),
         &[