Skip to content

Commit 72ea191

Browse files
committed
Use target_env = "musl" & target_abi = "pauthtest" instead of env
1 parent 27c6d20 commit 72ea191

4 files changed

Lines changed: 13 additions & 25 deletions

File tree

library/std/src/sys/pal/unix/stack_overflow.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,9 @@ mod imp {
409409

410410
unsafe {
411411
// this way someone on any unix-y OS can check that all these compile
412-
if cfg!(all(
413-
target_os = "linux",
414-
not(any(target_env = "musl", target_env = "pauthtest"))
415-
)) {
412+
if cfg!(all(target_os = "linux", not(target_env = "musl"))) {
416413
install_main_guard_linux(page_size)
417-
} else if cfg!(all(
418-
target_os = "linux",
419-
any(target_env = "musl", target_env = "pauthtest")
420-
)) {
414+
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
421415
install_main_guard_linux_musl(page_size)
422416
} else if cfg!(target_os = "freebsd") {
423417
#[cfg(not(target_os = "freebsd"))]
@@ -594,10 +588,7 @@ mod imp {
594588
let mut guardsize = 0;
595589
assert_eq!(libc::pthread_attr_getguardsize(attr.as_ptr(), &mut guardsize), 0);
596590
if guardsize == 0 {
597-
if cfg!(all(
598-
target_os = "linux",
599-
any(target_env = "musl", target_env = "pauthtest")
600-
)) {
591+
if cfg!(all(target_os = "linux", target_env = "musl")) {
601592
// musl versions before 1.1.19 always reported guard
602593
// size obtained from pthread_attr_get_np as zero.
603594
// Use page size as a fallback.
@@ -613,10 +604,7 @@ mod imp {
613604
let stackaddr = stackptr.addr();
614605
ret = if cfg!(any(target_os = "freebsd", target_os = "netbsd", target_os = "hurd")) {
615606
Some(stackaddr - guardsize..stackaddr)
616-
} else if cfg!(all(
617-
target_os = "linux",
618-
any(target_env = "musl", target_env = "pauthtest")
619-
)) {
607+
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
620608
Some(stackaddr - guardsize..stackaddr)
621609
} else if cfg!(all(target_os = "linux", any(target_env = "gnu", target_env = "uclibc")))
622610
{

library/std/src/sys/personality/gcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const UNWIND_DATA_REG: (i32, i32) = (4, 5); // a0, a1
9191

9292
unsafe fn sign_lpad(context: *mut uw::_Unwind_Context, lpad: *const u8) -> *const u8 {
9393
cfg_select! {
94-
all(target_env = "pauthtest", target_arch = "aarch64") => {
94+
all(target_abi = "pauthtest", target_arch = "aarch64") => {
9595
// DWARF register number for SP on AArch64.
9696
const SP_REG: i32 = 31;
9797

library/std_detect/src/detect/os/linux/auxvec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub(crate) struct AuxVec {
5151
/// Note that run-time feature detection is not invoked for features that can
5252
/// be detected at compile-time.
5353
///
54-
/// Note: We always directly use `getauxval` on `*-linux-{gnu,musl,ohos,pauthtest}*` and
54+
/// Note: We always directly use `getauxval` on `*-linux-{gnu,musl,ohos}*` and
5555
/// `*-android*` targets rather than `dlsym` it because we can safely assume
5656
/// `getauxval` is linked to the binary.
5757
/// - `*-linux-gnu*` targets ([since Rust 1.64](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html))
@@ -125,7 +125,7 @@ fn getauxval(key: usize) -> Result<usize, ()> {
125125
any(
126126
all(
127127
target_os = "linux",
128-
any(target_env = "gnu", target_env = "musl", target_env = "ohos", target_env = "pauthtest"),
128+
any(target_env = "gnu", target_env = "musl", target_env = "ohos"),
129129
),
130130
target_os = "android",
131131
) => {

library/unwind/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ cfg_select! {
5757
}
5858
}
5959

60-
#[cfg(target_env = "musl")]
60+
// For pauthtest the only supported unwinding mechanism is provided by libunwind.
61+
#[cfg(target_abi = "pauthtest")]
62+
#[link(name = "unwind")]
63+
unsafe extern "C" {}
64+
65+
#[cfg(all(target_env = "musl", not(target_abi = "pauthtest")))]
6166
cfg_select! {
6267
all(feature = "llvm-libunwind", feature = "system-llvm-libunwind") => {
6368
compile_error!("`llvm-libunwind` and `system-llvm-libunwind` cannot be enabled at the same time");
@@ -95,11 +100,6 @@ cfg_select! {
95100
}
96101
}
97102

98-
// For pauthtest the only supported unwinding mechanism is provided by libunwind.
99-
#[cfg(target_env = "pauthtest")]
100-
#[link(name = "unwind")]
101-
unsafe extern "C" {}
102-
103103
// This is the same as musl except that we default to using the system libunwind
104104
// instead of libgcc.
105105
#[cfg(target_env = "ohos")]

0 commit comments

Comments
 (0)