Skip to content

Commit a40cc6a

Browse files
committed
Don't compile probestack functions during testing
1 parent b3679bc commit a40cc6a

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/probestack.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
#![cfg(not(windows))] // Windows already has builtins to do this
4545

4646
#[naked]
47-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
48-
#[cfg(target_arch = "x86_64")]
47+
#[no_mangle]
48+
#[cfg(all(target_arch = "x86_64", not(feature = "mangled-names")))]
4949
pub unsafe extern fn __rust_probestack() {
5050
// Our goal here is to touch each page between %rsp+8 and %rsp+8-%rax,
5151
// ensuring that if any pages are unmapped we'll make a page fault.
@@ -87,8 +87,8 @@ pub unsafe extern fn __rust_probestack() {
8787
}
8888

8989
#[naked]
90-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
91-
#[cfg(target_arch = "x86")]
90+
#[no_mangle]
91+
#[cfg(all(target_arch = "x86", not(feature = "mangled-names")))]
9292
pub unsafe extern fn __rust_probestack() {
9393
// This is the same as x86_64 above, only translated for 32-bit sizes. Note
9494
// that on Unix we're expected to restore everything as it was, this

src/x86.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use core::intrinsics;
88
// NOTE These functions are never mangled as they are not tested against compiler-rt
99
// and mangling ___chkstk would break the `jmp ___chkstk` instruction in __alloca
1010

11-
#[cfg(all(windows, target_env = "gnu"))]
11+
#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
1212
#[naked]
13-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
13+
#[no_mangle]
1414
pub unsafe fn ___chkstk_ms() {
1515
asm!("
1616
push %ecx
@@ -34,17 +34,17 @@ pub unsafe fn ___chkstk_ms() {
3434
}
3535

3636
// FIXME: __alloca should be an alias to __chkstk
37-
#[cfg(all(windows, target_env = "gnu"))]
37+
#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
3838
#[naked]
39-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
39+
#[no_mangle]
4040
pub unsafe fn __alloca() {
4141
asm!("jmp ___chkstk // Jump to ___chkstk since fallthrough may be unreliable");
4242
intrinsics::unreachable();
4343
}
4444

45-
#[cfg(all(windows, target_env = "gnu"))]
45+
#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
4646
#[naked]
47-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
47+
#[no_mangle]
4848
pub unsafe fn ___chkstk() {
4949
asm!("
5050
push %ecx

src/x86_64.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use core::intrinsics;
88
// NOTE These functions are never mangled as they are not tested against compiler-rt
99
// and mangling ___chkstk would break the `jmp ___chkstk` instruction in __alloca
1010

11-
#[cfg(all(windows, target_env = "gnu"))]
11+
#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
1212
#[naked]
13-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
13+
#[no_mangle]
1414
pub unsafe fn ___chkstk_ms() {
1515
asm!("
1616
push %rcx
@@ -33,18 +33,18 @@ pub unsafe fn ___chkstk_ms() {
3333
intrinsics::unreachable();
3434
}
3535

36-
#[cfg(all(windows, target_env = "gnu"))]
36+
#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
3737
#[naked]
38-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
38+
#[no_mangle]
3939
pub unsafe fn __alloca() {
4040
asm!("mov %rcx,%rax // x64 _alloca is a normal function with parameter in rcx
4141
jmp ___chkstk // Jump to ___chkstk since fallthrough may be unreliable");
4242
intrinsics::unreachable();
4343
}
4444

45-
#[cfg(all(windows, target_env = "gnu"))]
45+
#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
4646
#[naked]
47-
#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
47+
#[no_mangle]
4848
pub unsafe fn ___chkstk() {
4949
asm!("
5050
push %rcx

0 commit comments

Comments
 (0)