Browse Source

Don't compile probestack functions during testing

Matt Ickstadt 7 years ago
parent
commit
a40cc6a12d
3 changed files with 16 additions and 16 deletions
  1. 4 4
      src/probestack.rs
  2. 6 6
      src/x86.rs
  3. 6 6
      src/x86_64.rs

+ 4 - 4
src/probestack.rs

@@ -44,8 +44,8 @@
 #![cfg(not(windows))] // Windows already has builtins to do this
 
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
-#[cfg(target_arch = "x86_64")]
+#[no_mangle]
+#[cfg(all(target_arch = "x86_64", not(feature = "mangled-names")))]
 pub unsafe extern fn __rust_probestack() {
     // Our goal here is to touch each page between %rsp+8 and %rsp+8-%rax,
     // ensuring that if any pages are unmapped we'll make a page fault.
@@ -87,8 +87,8 @@ pub unsafe extern fn __rust_probestack() {
 }
 
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
-#[cfg(target_arch = "x86")]
+#[no_mangle]
+#[cfg(all(target_arch = "x86", not(feature = "mangled-names")))]
 pub unsafe extern fn __rust_probestack() {
     // This is the same as x86_64 above, only translated for 32-bit sizes. Note
     // that on Unix we're expected to restore everything as it was, this

+ 6 - 6
src/x86.rs

@@ -8,9 +8,9 @@ use core::intrinsics;
 // NOTE These functions are never mangled as they are not tested against compiler-rt
 // and mangling ___chkstk would break the `jmp ___chkstk` instruction in __alloca
 
-#[cfg(all(windows, target_env = "gnu"))]
+#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+#[no_mangle]
 pub unsafe fn ___chkstk_ms() {
     asm!("
         push   %ecx
@@ -34,17 +34,17 @@ pub unsafe fn ___chkstk_ms() {
 }
 
 // FIXME: __alloca should be an alias to __chkstk
-#[cfg(all(windows, target_env = "gnu"))]
+#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+#[no_mangle]
 pub unsafe fn __alloca() {
     asm!("jmp ___chkstk   // Jump to ___chkstk since fallthrough may be unreliable");
     intrinsics::unreachable();
 }
 
-#[cfg(all(windows, target_env = "gnu"))]
+#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+#[no_mangle]
 pub unsafe fn ___chkstk() {
     asm!("
         push   %ecx

+ 6 - 6
src/x86_64.rs

@@ -8,9 +8,9 @@ use core::intrinsics;
 // NOTE These functions are never mangled as they are not tested against compiler-rt
 // and mangling ___chkstk would break the `jmp ___chkstk` instruction in __alloca
 
-#[cfg(all(windows, target_env = "gnu"))]
+#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+#[no_mangle]
 pub unsafe fn ___chkstk_ms() {
     asm!("
         push   %rcx
@@ -33,18 +33,18 @@ pub unsafe fn ___chkstk_ms() {
     intrinsics::unreachable();
 }
 
-#[cfg(all(windows, target_env = "gnu"))]
+#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+#[no_mangle]
 pub unsafe fn __alloca() {
     asm!("mov    %rcx,%rax  // x64 _alloca is a normal function with parameter in rcx
           jmp    ___chkstk  // Jump to ___chkstk since fallthrough may be unreliable");
     intrinsics::unreachable();
 }
 
-#[cfg(all(windows, target_env = "gnu"))]
+#[cfg(all(windows, target_env = "gnu", not(feature = "mangled-names")))]
 #[naked]
-#[cfg_attr(not(feature = "mangled-names"), no_mangle)]
+#[no_mangle]
 pub unsafe fn ___chkstk() {
     asm!("
         push   %rcx