From 233dede5b67ef6edc97797663a671538dcbd3c57 Mon Sep 17 00:00:00 2001 From: cynecx Date: Sun, 28 Nov 2021 21:52:27 +0100 Subject: [PATCH] fix inline asm test by not hardcoding symbol names --- src/test/ui/asm/aarch64/may_unwind.rs | 12 +++++++++--- src/test/ui/asm/x86_64/may_unwind.rs | 12 +++++++++--- 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 @@ fn drop(&mut self) { } } -#[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 @@ fn drop(&mut self) { } } -#[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);