Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 29, 2024
1 parent 9d5824c commit 9da4c08
Show file tree
Hide file tree
Showing 576 changed files with 63,152 additions and 443 deletions.
11 changes: 11 additions & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ csrsi
cxchg
cxchgweak
DESTDIR
dlfcn
dlsym
DWCAS
ecall
elems
espup
evbmips
exynos
fild
fistp
Expand Down Expand Up @@ -89,11 +91,15 @@ libtest
linkall
locgr
locgre
loongson
lqarx
lrcpc
lwsync
mabi
machdep
macppc
maxu
mbig
mfcr
mfence
mgba
Expand All @@ -114,6 +120,7 @@ newtype
nngrk
nostartfiles
nostdinc
octeon
opensbi
osfmk
osxsave
Expand All @@ -132,6 +139,7 @@ richlowe
rsbegin
rsend
rsil
RTLD
sbcs
selgr
seqlock
Expand Down Expand Up @@ -165,9 +173,11 @@ subfze
swpp
syscall
sysctlbyname
sysctlnametomib
sysctlnode
sysdeps
systemsim
sysv
tagme
uapi
uart
Expand All @@ -187,6 +197,7 @@ vmovdqa
vtable
vtables
wokwi
wordsize
xadd
xchg
xgetbv
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,26 @@ jobs:
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@nightly
- run: |
sudo apt-get -o Acquire::Retries=10 -qq update && sudo apt-get -o Acquire::Retries=10 -o Dpkg::Use-Pty=0 install -y --no-install-recommends \
gcc-arm-linux-gnueabi \
gcc-i686-linux-gnu \
gcc-m68k-linux-gnu \
gcc-mips-linux-gnu \
gcc-mips64-linux-gnuabi64 \
gcc-mips64el-linux-gnuabi64 \
gcc-mipsel-linux-gnu \
gcc-mipsisa32r6-linux-gnu \
gcc-mipsisa32r6el-linux-gnu \
gcc-mipsisa64r6-linux-gnuabi64 \
gcc-mipsisa64r6el-linux-gnuabi64 \
gcc-powerpc-linux-gnu \
gcc-powerpc64-linux-gnu \
gcc-powerpc64le-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-s390x-linux-gnu \
gcc-sparc64-linux-gnu \
gcc-x86-64-linux-gnux32
- run: tools/no_atomic.sh
- run: tools/gen.sh
- id: diff
Expand Down
6 changes: 3 additions & 3 deletions src/imp/detect/aarch64_aa64reg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ mod imp {

use super::AA64Reg;

// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[allow(non_camel_case_types)]
pub(super) mod ffi {
pub(crate) use super::super::c_types::{c_char, c_int, c_size_t, c_void};

// Defined in aarch64/armreg.h.
// Defined in machine/armreg.h.
// https://github.com/NetBSD/src/blob/432a1357026b10c184d8a0ddb683008a23cc7cd9/sys/arch/aarch64/include/armreg.h#L1863
#[derive(Clone, Copy)]
#[repr(C)]
Expand Down Expand Up @@ -225,7 +225,7 @@ mod imp {

use super::AA64Reg;

// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[allow(non_camel_case_types)]
pub(super) mod ffi {
pub(crate) use super::super::c_types::{c_int, c_size_t, c_uint, c_void};
Expand Down
2 changes: 1 addition & 1 deletion src/imp/detect/aarch64_apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include!("common.rs");

use core::ptr;

// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[allow(non_camel_case_types)]
mod ffi {
pub(crate) use super::c_types::{c_char, c_int, c_size_t, c_void};
Expand Down
2 changes: 1 addition & 1 deletion src/imp/detect/aarch64_illumos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Run-time detection on AArch64 illumos is currently disabled by default as AArch6

include!("common.rs");

// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[allow(non_camel_case_types)]
mod ffi {
pub(crate) use super::c_types::c_uint;
Expand Down
6 changes: 3 additions & 3 deletions src/imp/detect/auxv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ include!("common.rs");
use os::ffi;
#[cfg(any(target_os = "linux", target_os = "android"))]
mod os {
// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[cfg_attr(test, allow(dead_code))]
pub(super) mod ffi {
pub(crate) use super::super::c_types::c_ulong;
Expand Down Expand Up @@ -180,7 +180,7 @@ mod os {
}
#[cfg(any(target_os = "freebsd", target_os = "openbsd"))]
mod os {
// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[cfg_attr(test, allow(dead_code))]
pub(super) mod ffi {
pub(crate) use super::super::c_types::{c_int, c_ulong, c_void};
Expand Down Expand Up @@ -231,7 +231,7 @@ mod os {
}

// Basically, Linux/FreeBSD/OpenBSD use the same hwcap values.
// FreeBSD/OpenBSD supports a subset of the hwcap values supported by Linux.
// FreeBSD and OpenBSD usually support a subset of the hwcap values supported by Linux.
use arch::_detect;
#[cfg(target_arch = "aarch64")]
mod arch {
Expand Down
46 changes: 32 additions & 14 deletions src/imp/detect/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ flags! {
HAS_VMOVDQA_ATOMIC(2, has_vmovdqa_atomic, "vmovdqa-atomic", any(/* always false */)),
}

// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
#[cfg(not(target_arch = "x86_64"))]
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
#[cfg(not(windows))]
#[allow(dead_code, non_camel_case_types)]
mod c_types {
Expand All @@ -146,19 +146,37 @@ mod c_types {
// c_size_t is currently always usize
// https://github.com/rust-lang/rust/blob/1.80.0/library/core/src/ffi/mod.rs#L67
pub(crate) type c_size_t = usize;
// c_char is u8 by default on most non-Apple/non-Windows Arm/PowerPC/RISC-V/s390x/Hexagon targets
// (Linux/Android/FreeBSD/NetBSD/OpenBSD/VxWorks/Fuchsia/QNX Neutrino/Horizon/AIX/z/OS)
// https://github.com/rust-lang/rust/blob/1.80.0/library/core/src/ffi/mod.rs#L83
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/lldb/source/Utility/ArchSpec.cpp#L712
// RISC-V https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/draft-20240829-13bfa9f54634cb60d86b9b333e109f077805b4b3/riscv-cc.adoc#cc-type-representations
// Hexagon https://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/21516a52/attachment-0001.pdf
// AIX https://www.ibm.com/docs/en/xl-c-aix/13.1.3?topic=specifiers-character-types
// z/OS https://www.ibm.com/docs/en/zos/3.1.0?topic=specifiers-character-types
// (Windows currently doesn't use this module)
#[cfg(not(target_vendor = "apple"))]
// c_char is u8 by default on most non-Apple/non-Windows Arm/PowerPC/RISC-V/s390x/Hexagon/C-SKY targets
// See references in https://github.com/rust-lang/rust/issues/129945 for details.
#[cfg(all(
not(any(target_vendor = "apple", windows)),
any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "csky",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "riscv32",
target_arch = "riscv64",
target_arch = "s390x",
),
))]
pub(crate) type c_char = u8;
// c_char is i8 on all Apple targets
#[cfg(target_vendor = "apple")]
#[cfg(not(all(
not(any(target_vendor = "apple", windows)),
any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "csky",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "riscv32",
target_arch = "riscv64",
target_arch = "s390x",
),
)))]
pub(crate) type c_char = i8;

// Static assertions for C type definitions.
Expand Down
2 changes: 1 addition & 1 deletion src/imp/detect/riscv_linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ include!("common.rs");

use core::ptr;

// core::ffi::c_* (except c_void) requires Rust 1.64, libc will soon require Rust 1.47
// core::ffi::c_* (except c_void) requires Rust 1.64, libc 1.0 plans to require Rust 1.63
#[allow(non_camel_case_types, non_upper_case_globals)]
mod ffi {
pub(crate) use super::c_types::{c_long, c_size_t, c_uint, c_ulong};
Expand Down
11 changes: 8 additions & 3 deletions tests/helper/src/cpuinfo.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

#![cfg(any(target_arch = "aarch64", target_arch = "arm64ec", target_arch = "powerpc64"))]
#![cfg(any(
target_arch = "aarch64",
target_arch = "arm64ec",
target_arch = "powerpc",
target_arch = "powerpc64",
))]

use std::{boxed::Box, path::Path, vec::Vec};

Expand All @@ -25,7 +30,7 @@ pub struct ProcCpuinfo {
pub rcpc3: Option<bool>,
pub lse128: Option<bool>,
}
#[cfg(target_arch = "powerpc64")]
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
#[derive(Debug, Clone, Copy)]
pub struct ProcCpuinfo {
pub power8: bool,
Expand Down Expand Up @@ -142,7 +147,7 @@ impl ProcCpuinfo {
Err("unsupported OS".into())
}
}
#[cfg(target_arch = "powerpc64")]
#[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))]
pub fn new() -> Result<Self> {
if cfg!(any(target_os = "linux", target_os = "android", target_os = "netbsd")) {
let text = fs::read_to_string("/proc/cpuinfo")?;
Expand Down
4 changes: 4 additions & 0 deletions tests/helper/src/gen/sys/aarch64_apple_darwin/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions tests/helper/src/gen/sys/aarch64_apple_darwin/sys_sysctl.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/helper/src/gen/sys/aarch64_apple_ios/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions tests/helper/src/gen/sys/aarch64_apple_ios/sys_sysctl.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/helper/src/gen/sys/aarch64_apple_tvos/mod.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions tests/helper/src/gen/sys/aarch64_apple_tvos/sys_sysctl.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9da4c08

Please sign in to comment.