Skip to content

Commit 9e2c658

Browse files
daxpeddaRalfJung
andcommitted
Remove TargetOptions::default_adjusted_cabi
Co-Authored-By: Ralf Jung <[email protected]>
1 parent f09c19a commit 9e2c658

File tree

2 files changed

+4
-34
lines changed

2 files changed

+4
-34
lines changed

compiler/rustc_target/src/spec/mod.rs

+4-23
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
use crate::abi::call::Conv;
3838
use crate::abi::{Endian, Integer, Size, TargetDataLayout, TargetDataLayoutErrors};
3939
use crate::json::{Json, ToJson};
40-
use crate::spec::abi::{lookup as lookup_abi, Abi};
40+
use crate::spec::abi::Abi;
4141
use crate::spec::crt_objects::CrtObjects;
4242
use rustc_fs_util::try_canonicalize;
4343
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
@@ -2167,9 +2167,6 @@ pub struct TargetOptions {
21672167
/// distributed with the target, the sanitizer should still appear in this list for the target.
21682168
pub supported_sanitizers: SanitizerSet,
21692169

2170-
/// If present it's a default value to use for adjusting the C ABI.
2171-
pub default_adjusted_cabi: Option<Abi>,
2172-
21732170
/// Minimum number of bits in #[repr(C)] enum. Defaults to the size of c_int
21742171
pub c_enum_min_bits: Option<u64>,
21752172

@@ -2399,7 +2396,6 @@ impl Default for TargetOptions {
23992396
// `Off` is supported by default, but targets can remove this manually, e.g. Windows.
24002397
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
24012398
supported_sanitizers: SanitizerSet::empty(),
2402-
default_adjusted_cabi: None,
24032399
c_enum_min_bits: None,
24042400
generate_arange_section: true,
24052401
supports_stack_protector: true,
@@ -2438,11 +2434,11 @@ impl Target {
24382434
Abi::C { .. } => {
24392435
if self.arch == "wasm32"
24402436
&& self.os == "unknown"
2441-
&& cx.wasm_c_abi_opt() == WasmCAbi::Spec
2437+
&& cx.wasm_c_abi_opt() == WasmCAbi::Legacy
24422438
{
2443-
abi
2439+
Abi::Wasm
24442440
} else {
2445-
self.default_adjusted_cabi.unwrap_or(abi)
2441+
abi
24462442
}
24472443
}
24482444

@@ -2967,16 +2963,6 @@ impl Target {
29672963
}
29682964
}
29692965
} );
2970-
($key_name:ident, Option<Abi>) => ( {
2971-
let name = (stringify!($key_name)).replace("_", "-");
2972-
obj.remove(&name).and_then(|o| o.as_str().and_then(|s| {
2973-
match lookup_abi(s) {
2974-
Ok(abi) => base.$key_name = Some(abi),
2975-
_ => return Some(Err(format!("'{}' is not a valid value for abi", s))),
2976-
}
2977-
Some(Ok(()))
2978-
})).unwrap_or(Ok(()))
2979-
} );
29802966
($key_name:ident, TargetFamilies) => ( {
29812967
if let Some(value) = obj.remove("target-family") {
29822968
if let Some(v) = value.as_array() {
@@ -3126,7 +3112,6 @@ impl Target {
31263112
key!(split_debuginfo, SplitDebuginfo)?;
31273113
key!(supported_split_debuginfo, fallible_list)?;
31283114
key!(supported_sanitizers, SanitizerSet)?;
3129-
key!(default_adjusted_cabi, Option<Abi>)?;
31303115
key!(generate_arange_section, bool);
31313116
key!(supports_stack_protector, bool);
31323117
key!(entry_name);
@@ -3390,10 +3375,6 @@ impl ToJson for Target {
33903375
target_option_val!(entry_abi);
33913376
target_option_val!(supports_xray);
33923377

3393-
if let Some(abi) = self.default_adjusted_cabi {
3394-
d.insert("default-adjusted-cabi".into(), Abi::name(abi).to_json());
3395-
}
3396-
33973378
// Serializing `-Clink-self-contained` needs a dynamic key to support the
33983379
// backwards-compatible variants.
33993380
d.insert(self.link_self_contained.json_key().into(), self.link_self_contained.to_json());

compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs

-11
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,12 @@
1010
//! This target is more or less managed by the Rust and WebAssembly Working
1111
//! Group nowadays at <https://github.com/rustwasm>.
1212
13-
use crate::spec::abi::Abi;
1413
use crate::spec::{base, Cc, LinkerFlavor, Target};
1514

1615
pub fn target() -> Target {
1716
let mut options = base::wasm::options();
1817
options.os = "unknown".into();
1918

20-
// This is a default for backwards-compatibility with the original
21-
// definition of this target oh-so-long-ago. Once the "wasm" ABI is
22-
// stable and the wasm-bindgen project has switched to using it then there's
23-
// no need for this and it can be removed.
24-
//
25-
// Currently this is the reason that this target's ABI is mismatched with
26-
// clang's ABI. This means that, in the limit, you can't merge C and Rust
27-
// code on this target due to this ABI mismatch.
28-
options.default_adjusted_cabi = Some(Abi::Wasm);
29-
3019
options.add_pre_link_args(
3120
LinkerFlavor::WasmLld(Cc::No),
3221
&[

0 commit comments

Comments
 (0)