Skip to content

Commit 233dede

Browse files
committed
fix inline asm test by not hardcoding symbol names
1 parent 7f870be commit 233dede

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/test/ui/asm/aarch64/may_unwind.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// run-pass
44
// needs-asm-support
55

6-
#![feature(asm, asm_unwind)]
6+
#![feature(asm, asm_sym, asm_unwind)]
77

88
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
99

@@ -15,7 +15,6 @@ impl Drop for Foo<'_> {
1515
}
1616
}
1717

18-
#[no_mangle]
1918
extern "C" fn panicky() {
2019
resume_unwind(Box::new(()));
2120
}
@@ -24,7 +23,14 @@ fn main() {
2423
let flag = &mut true;
2524
catch_unwind(AssertUnwindSafe(|| {
2625
let _foo = Foo(flag);
27-
unsafe { asm!("bl _panicky", clobber_abi("C"), options(may_unwind)) };
26+
unsafe {
27+
asm!(
28+
"bl {}",
29+
sym panicky,
30+
clobber_abi("C"),
31+
options(may_unwind)
32+
);
33+
}
2834
}))
2935
.expect_err("expected a panic");
3036
assert_eq!(*flag, false);

src/test/ui/asm/x86_64/may_unwind.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// run-pass
44
// needs-asm-support
55

6-
#![feature(asm, asm_unwind)]
6+
#![feature(asm, asm_sym, asm_unwind)]
77

88
use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
99

@@ -15,7 +15,6 @@ impl Drop for Foo<'_> {
1515
}
1616
}
1717

18-
#[no_mangle]
1918
extern "C" fn panicky() {
2019
resume_unwind(Box::new(()));
2120
}
@@ -24,7 +23,14 @@ fn main() {
2423
let flag = &mut true;
2524
catch_unwind(AssertUnwindSafe(|| {
2625
let _foo = Foo(flag);
27-
unsafe { asm!("call panicky", clobber_abi("C"), options(may_unwind)) };
26+
unsafe {
27+
asm!(
28+
"call {}",
29+
sym panicky,
30+
clobber_abi("C"),
31+
options(may_unwind)
32+
);
33+
}
2834
}))
2935
.expect_err("expected a panic");
3036
assert_eq!(*flag, false);

0 commit comments

Comments
 (0)