Remove TargetOptions::default_adjusted_cabi
Co-Authored-By: Ralf Jung <330628+RalfJung@users.noreply.github.com>
This commit is contained in:
parent
f09c19ac3a
commit
9e2c65893d
@ -37,7 +37,7 @@
|
|||||||
use crate::abi::call::Conv;
|
use crate::abi::call::Conv;
|
||||||
use crate::abi::{Endian, Integer, Size, TargetDataLayout, TargetDataLayoutErrors};
|
use crate::abi::{Endian, Integer, Size, TargetDataLayout, TargetDataLayoutErrors};
|
||||||
use crate::json::{Json, ToJson};
|
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 crate::spec::crt_objects::CrtObjects;
|
||||||
use rustc_fs_util::try_canonicalize;
|
use rustc_fs_util::try_canonicalize;
|
||||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
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.
|
/// distributed with the target, the sanitizer should still appear in this list for the target.
|
||||||
pub supported_sanitizers: SanitizerSet,
|
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
|
/// Minimum number of bits in #[repr(C)] enum. Defaults to the size of c_int
|
||||||
pub c_enum_min_bits: Option<u64>,
|
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.
|
// `Off` is supported by default, but targets can remove this manually, e.g. Windows.
|
||||||
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
|
supported_split_debuginfo: Cow::Borrowed(&[SplitDebuginfo::Off]),
|
||||||
supported_sanitizers: SanitizerSet::empty(),
|
supported_sanitizers: SanitizerSet::empty(),
|
||||||
default_adjusted_cabi: None,
|
|
||||||
c_enum_min_bits: None,
|
c_enum_min_bits: None,
|
||||||
generate_arange_section: true,
|
generate_arange_section: true,
|
||||||
supports_stack_protector: true,
|
supports_stack_protector: true,
|
||||||
@ -2438,11 +2434,11 @@ impl Target {
|
|||||||
Abi::C { .. } => {
|
Abi::C { .. } => {
|
||||||
if self.arch == "wasm32"
|
if self.arch == "wasm32"
|
||||||
&& self.os == "unknown"
|
&& self.os == "unknown"
|
||||||
&& cx.wasm_c_abi_opt() == WasmCAbi::Spec
|
&& cx.wasm_c_abi_opt() == WasmCAbi::Legacy
|
||||||
{
|
{
|
||||||
abi
|
Abi::Wasm
|
||||||
} else {
|
} 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) => ( {
|
($key_name:ident, TargetFamilies) => ( {
|
||||||
if let Some(value) = obj.remove("target-family") {
|
if let Some(value) = obj.remove("target-family") {
|
||||||
if let Some(v) = value.as_array() {
|
if let Some(v) = value.as_array() {
|
||||||
@ -3126,7 +3112,6 @@ impl Target {
|
|||||||
key!(split_debuginfo, SplitDebuginfo)?;
|
key!(split_debuginfo, SplitDebuginfo)?;
|
||||||
key!(supported_split_debuginfo, fallible_list)?;
|
key!(supported_split_debuginfo, fallible_list)?;
|
||||||
key!(supported_sanitizers, SanitizerSet)?;
|
key!(supported_sanitizers, SanitizerSet)?;
|
||||||
key!(default_adjusted_cabi, Option<Abi>)?;
|
|
||||||
key!(generate_arange_section, bool);
|
key!(generate_arange_section, bool);
|
||||||
key!(supports_stack_protector, bool);
|
key!(supports_stack_protector, bool);
|
||||||
key!(entry_name);
|
key!(entry_name);
|
||||||
@ -3390,10 +3375,6 @@ impl ToJson for Target {
|
|||||||
target_option_val!(entry_abi);
|
target_option_val!(entry_abi);
|
||||||
target_option_val!(supports_xray);
|
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
|
// Serializing `-Clink-self-contained` needs a dynamic key to support the
|
||||||
// backwards-compatible variants.
|
// backwards-compatible variants.
|
||||||
d.insert(self.link_self_contained.json_key().into(), self.link_self_contained.to_json());
|
d.insert(self.link_self_contained.json_key().into(), self.link_self_contained.to_json());
|
||||||
|
@ -10,23 +10,12 @@
|
|||||||
//! This target is more or less managed by the Rust and WebAssembly Working
|
//! This target is more or less managed by the Rust and WebAssembly Working
|
||||||
//! Group nowadays at <https://github.com/rustwasm>.
|
//! Group nowadays at <https://github.com/rustwasm>.
|
||||||
|
|
||||||
use crate::spec::abi::Abi;
|
|
||||||
use crate::spec::{base, Cc, LinkerFlavor, Target};
|
use crate::spec::{base, Cc, LinkerFlavor, Target};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
let mut options = base::wasm::options();
|
let mut options = base::wasm::options();
|
||||||
options.os = "unknown".into();
|
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(
|
options.add_pre_link_args(
|
||||||
LinkerFlavor::WasmLld(Cc::No),
|
LinkerFlavor::WasmLld(Cc::No),
|
||||||
&[
|
&[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user