Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ mod tests {
assert_eq!(OperatingSystem::host(), OperatingSystem::Windows);
}

#[cfg(target_os = "zos")]
#[test]
fn test_zos() {
use super::*;
assert_eq!(OperatingSystem::host(), OperatingSystem::Zos);
}

#[cfg(target_pointer_width = "16")]
#[test]
fn test_ptr16() {
Expand Down
8 changes: 8 additions & 0 deletions src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ pub enum OperatingSystem {
Windows,
/// An alternate name for [visionOS][Self::VisionOS].
XROS(Option<DeploymentTarget>),
Zos,
}

impl OperatingSystem {
Expand Down Expand Up @@ -819,6 +820,7 @@ impl OperatingSystem {
WatchOS(deployment_target) => darwin_version("watchos", deployment_target),
Windows => Cow::Borrowed("windows"),
XROS(deployment_target) => darwin_version("xros", deployment_target),
Zos => Cow::Borrowed("zos"),
}
}

Expand Down Expand Up @@ -943,6 +945,7 @@ pub enum BinaryFormat {
Macho,
Wasm,
Xcoff,
Goff,
}

impl BinaryFormat {
Expand All @@ -957,6 +960,7 @@ impl BinaryFormat {
Macho => Cow::Borrowed("macho"),
Wasm => Cow::Borrowed("wasm"),
Xcoff => Cow::Borrowed("xcoff"),
Goff => Cow::Borrowed("goff"),
}
}
}
Expand Down Expand Up @@ -1133,6 +1137,7 @@ pub(crate) fn default_binary_format(triple: &Triple) -> BinaryFormat {
OperatingSystem::Aix => BinaryFormat::Xcoff,
os if os.is_like_darwin() => BinaryFormat::Macho,
OperatingSystem::Windows => BinaryFormat::Coff,
OperatingSystem::Zos => BinaryFormat::Goff,
OperatingSystem::Nebulet
| OperatingSystem::Emscripten
| OperatingSystem::VxWorks
Expand Down Expand Up @@ -1667,6 +1672,7 @@ impl FromStr for OperatingSystem {
"wasip1" => WasiP1,
"wasip2" => WasiP2,
"windows" => Windows,
"zos" => Zos,
"espidf" => Espidf,
_ => return Err(()),
})
Expand Down Expand Up @@ -1745,6 +1751,7 @@ impl FromStr for BinaryFormat {
"macho" => Macho,
"wasm" => Wasm,
"xcoff" => Xcoff,
"goff" => Goff,
_ => return Err(()),
})
}
Expand Down Expand Up @@ -1949,6 +1956,7 @@ mod tests {
"riscv64gc-unknown-openbsd",
"riscv64imac-unknown-none-elf",
"riscv64-linux-android",
"s390x-ibm-zos",
"s390x-unknown-linux-gnu",
"s390x-unknown-linux-musl",
"sparc64-unknown-linux-gnu",
Expand Down
5 changes: 5 additions & 0 deletions src/triple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ pub enum CallingConvention {
///
/// <https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms>
AppleAarch64,

/// IBM z/OS XPLINK CALL linkage conventions for AMODE 64 applications
/// https://www.ibm.com/docs/en/zos/3.1.0?topic=applications-xplink-call-linkage-conventions-amode-64
ZosXplink64,
}

/// An LLVM target "triple". Historically such things had three fields, though
Expand Down Expand Up @@ -141,6 +145,7 @@ impl Triple {
| OperatingSystem::Redox
| OperatingSystem::Solaris => CallingConvention::SystemV,
OperatingSystem::Windows => CallingConvention::WindowsFastcall,
OperatingSystem::Zos => CallingConvention::ZosXplink64,
OperatingSystem::Nebulet
| OperatingSystem::Emscripten
| OperatingSystem::Wasi
Expand Down
Loading