mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Use JSON "binary-format" to decide //@ only-elf and //@ ignore-elf
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use std::borrow::Cow;
|
||||
use std::collections::{BTreeSet, HashMap, HashSet};
|
||||
use std::iter;
|
||||
use std::process::Command;
|
||||
@@ -1011,6 +1012,13 @@ pub struct TargetCfg {
|
||||
// target spec).
|
||||
pub(crate) rustc_abi: Option<String>,
|
||||
|
||||
/// ELF is the "default" binary format, so the compiler typically doesn't
|
||||
/// emit a `"binary-format"` field for ELF targets.
|
||||
///
|
||||
/// See `impl ToJson for Target` in `compiler/rustc_target/src/spec/json.rs`.
|
||||
#[serde(default = "default_binary_format_elf")]
|
||||
pub(crate) binary_format: Cow<'static, str>,
|
||||
|
||||
// Not present in target cfg json output, additional derived information.
|
||||
#[serde(skip)]
|
||||
/// Supported target atomic widths: e.g. `8` to `128` or `ptr`. This is derived from the builtin
|
||||
@@ -1032,6 +1040,10 @@ fn default_reloc_model() -> String {
|
||||
"pic".into()
|
||||
}
|
||||
|
||||
fn default_binary_format_elf() -> Cow<'static, str> {
|
||||
Cow::Borrowed("elf")
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Debug, Default, serde::Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum Endian {
|
||||
|
||||
@@ -169,11 +169,7 @@ macro_rules! condition {
|
||||
|
||||
condition! {
|
||||
name: "elf",
|
||||
condition: !config.target.contains("windows")
|
||||
&& !config.target.contains("wasm")
|
||||
&& !config.target.contains("apple")
|
||||
&& !config.target.contains("aix")
|
||||
&& !config.target.contains("uefi"),
|
||||
condition: target_cfg.binary_format == "elf",
|
||||
message: "when the target binary format is ELF"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user