diff options
| author | bors <bors@rust-lang.org> | 2025-02-03 20:02:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-03 20:02:54 +0000 |
| commit | f027438f8bc6b747528dca8b8de13043544d7238 (patch) | |
| tree | 75d7d1ad77128b38b45ec546cadefafccc6ae109 /compiler/rustc_target/src/spec/json.rs | |
| parent | 534d79adf938fc3839fad47832c7cf2b4927d7d9 (diff) | |
| parent | 8596ce141c9ba714f39024b19afce63ca2184e67 (diff) | |
| download | rust-f027438f8bc6b747528dca8b8de13043544d7238.tar.gz rust-f027438f8bc6b747528dca8b8de13043544d7238.zip | |
Auto merge of #136146 - RalfJung:x86-abi, r=workingjubilee
Explicitly choose x86 softfloat/hardfloat ABI Part of https://github.com/rust-lang/rust/pull/135408: Instead of choosing this based on the target features listed in the target spec, make that choice explicit. All built-in targets are being updated here; custom (JSON-defined) x86 (32bit and 64bit) softfloat targets need to explicitly set `rustc-abi` to `x86-softfloat`.
Diffstat (limited to 'compiler/rustc_target/src/spec/json.rs')
| -rw-r--r-- | compiler/rustc_target/src/spec/json.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/spec/json.rs b/compiler/rustc_target/src/spec/json.rs index 015ea97f2ac..a6b0ec072e8 100644 --- a/compiler/rustc_target/src/spec/json.rs +++ b/compiler/rustc_target/src/spec/json.rs @@ -128,6 +128,19 @@ impl Target { Some(Ok(())) })).unwrap_or(Ok(())) } ); + ($key_name:ident, RustcAbi) => ( { + let name = (stringify!($key_name)).replace("_", "-"); + obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { + match s.parse::<super::RustcAbi>() { + Ok(rustc_abi) => base.$key_name = Some(rustc_abi), + _ => return Some(Err(format!( + "'{s}' is not a valid value for rustc-abi. \ + Use 'x86-softfloat' or leave the field unset." + ))), + } + Some(Ok(())) + })).unwrap_or(Ok(())) + } ); ($key_name:ident, RelocModel) => ( { let name = (stringify!($key_name)).replace("_", "-"); obj.remove(&name).and_then(|o| o.as_str().and_then(|s| { @@ -612,6 +625,7 @@ impl Target { key!(llvm_mcount_intrinsic, optional); key!(llvm_abiname); key!(llvm_floatabi, FloatAbi)?; + key!(rustc_abi, RustcAbi)?; key!(relax_elf_relocations, bool); key!(llvm_args, list); key!(use_ctors_section, bool); @@ -788,6 +802,7 @@ impl ToJson for Target { target_option_val!(llvm_mcount_intrinsic); target_option_val!(llvm_abiname); target_option_val!(llvm_floatabi); + target_option_val!(rustc_abi); target_option_val!(relax_elf_relocations); target_option_val!(llvm_args); target_option_val!(use_ctors_section); |
