Skip to content

Commit

Permalink
Remove TargetOptions::default_adjusted_cabi
Browse files Browse the repository at this point in the history
Co-Authored-By: Ralf Jung <[email protected]>
  • Loading branch information
daxpedda and RalfJung committed Mar 10, 2024
1 parent f09c19a commit 9e2c658
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 34 deletions.
27 changes: 4 additions & 23 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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>,

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
Expand Down
11 changes: 0 additions & 11 deletions compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
&[
Expand Down

0 comments on commit 9e2c658

Please sign in to comment.