about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorcynecx <me@cynecx.net>2021-11-28 21:52:27 +0100
committercynecx <me@cynecx.net>2021-12-03 23:51:49 +0100
commit233dede5b67ef6edc97797663a671538dcbd3c57 (patch)
tree7aff4d197f53822a34d6c444283632aff1cd292b /src
parent7f870be4b57586f0ecea23c155228209b02e3445 (diff)
downloadrust-233dede5b67ef6edc97797663a671538dcbd3c57.tar.gz
rust-233dede5b67ef6edc97797663a671538dcbd3c57.zip
fix inline asm test by not hardcoding symbol names
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/asm/aarch64/may_unwind.rs12
-rw-r--r--src/test/ui/asm/x86_64/may_unwind.rs12
2 files changed, 18 insertions, 6 deletions
diff --git a/src/test/ui/asm/aarch64/may_unwind.rs b/src/test/ui/asm/aarch64/may_unwind.rs
index 05892ec8a20..94cc7d75049 100644
--- a/src/test/ui/asm/aarch64/may_unwind.rs
+++ b/src/test/ui/asm/aarch64/may_unwind.rs
@@ -3,7 +3,7 @@
 // run-pass
 // needs-asm-support
 
-#![feature(asm, asm_unwind)]
+#![feature(asm, asm_sym, asm_unwind)]
 
 use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
 
@@ -15,7 +15,6 @@ impl Drop for Foo<'_> {
     }
 }
 
-#[no_mangle]
 extern "C" fn panicky() {
     resume_unwind(Box::new(()));
 }
@@ -24,7 +23,14 @@ fn main() {
     let flag = &mut true;
     catch_unwind(AssertUnwindSafe(|| {
         let _foo = Foo(flag);
-        unsafe { asm!("bl _panicky", clobber_abi("C"), options(may_unwind)) };
+        unsafe {
+            asm!(
+                "bl {}",
+                sym panicky,
+                clobber_abi("C"),
+                options(may_unwind)
+            );
+        }
     }))
     .expect_err("expected a panic");
     assert_eq!(*flag, false);
diff --git a/src/test/ui/asm/x86_64/may_unwind.rs b/src/test/ui/asm/x86_64/may_unwind.rs
index 0d7c055fff8..5ac4dd9b956 100644
--- a/src/test/ui/asm/x86_64/may_unwind.rs
+++ b/src/test/ui/asm/x86_64/may_unwind.rs
@@ -3,7 +3,7 @@
 // run-pass
 // needs-asm-support
 
-#![feature(asm, asm_unwind)]
+#![feature(asm, asm_sym, asm_unwind)]
 
 use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
 
@@ -15,7 +15,6 @@ impl Drop for Foo<'_> {
     }
 }
 
-#[no_mangle]
 extern "C" fn panicky() {
     resume_unwind(Box::new(()));
 }
@@ -24,7 +23,14 @@ fn main() {
     let flag = &mut true;
     catch_unwind(AssertUnwindSafe(|| {
         let _foo = Foo(flag);
-        unsafe { asm!("call panicky", clobber_abi("C"), options(may_unwind)) };
+        unsafe {
+            asm!(
+                "call {}",
+                sym panicky,
+                clobber_abi("C"),
+                options(may_unwind)
+            );
+        }
     }))
     .expect_err("expected a panic");
     assert_eq!(*flag, false);