Skip to content

Commit 0f918b8

Browse files
committed
Detect arm64-ilp32 just enough to say that it's not supported.
arm64-ilp32 is a 32-bit ABI on a 64-bit platform, just like x32 is a 32-bit abi on x86-64.
1 parent 61701af commit 0f918b8

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ fn main() {
2626
let arch = var("CARGO_CFG_TARGET_ARCH").unwrap();
2727
let asm_name = format!("{}/{}.s", OUTLINE_PATH, arch);
2828
let os_name = var("CARGO_CFG_TARGET_OS").unwrap();
29-
let is_x32 = arch == "x86_64" && var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() == "32";
29+
let pointer_width = var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap();
30+
let is_x32 = arch == "x86_64" && pointer_width == "32";
31+
let is_arm64_ilp32 = arch == "aarch64" && pointer_width == "32";
3032
println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH");
3133

3234
// If rustix_use_libc is set, or if we're on an architecture/OS that doesn't
@@ -35,6 +37,7 @@ fn main() {
3537
|| os_name != "linux"
3638
|| std::fs::metadata(&asm_name).is_err()
3739
|| is_x32
40+
|| is_arm64_ilp32
3841
{
3942
use_feature("libc");
4043
} else {

src/imp/linux_raw/arch/inline/aarch64.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
44
use core::arch::asm;
55

6+
#[cfg(target_pointer_width = "32")]
7+
compile_error!("arm64-ilp32 is not supported yet");
8+
69
#[inline]
710
#[must_use]
811
pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {

src/imp/linux_raw/arch/outline/aarch64.s

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
// outline.rs takes care of reordering the nr argument to the end for us,
88
// so we only need to move nr into w8.
9+
//
10+
// arm64-ilp32 is not yet supported.
911

1012
.file "aarch64.s"
1113
.arch armv8-a
Binary file not shown.

0 commit comments

Comments
 (0)