From bbcacddef691464e5abe373f95849670298c63a7 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Thu, 6 Aug 2020 12:11:49 -0400 Subject: [PATCH 1/3] Don't call a function in function-arguments-naked.rs Fixes #75096 It's U.B. to use anything other than inline assmebling in a naked function. Fortunately, the `#break` directive works fine without anything in the function body. --- src/test/debuginfo/function-arguments-naked.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/debuginfo/function-arguments-naked.rs b/src/test/debuginfo/function-arguments-naked.rs index e88a99b322ed5..f8e6253448a3f 100644 --- a/src/test/debuginfo/function-arguments-naked.rs +++ b/src/test/debuginfo/function-arguments-naked.rs @@ -34,7 +34,5 @@ fn main() { #[naked] fn naked(x: usize, y: usize) { - zzz(); // #break + // #break } - -fn zzz() { () } From 91dda2c24ef245939c4ef0248380aa05583e3e30 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Fri, 7 Aug 2020 09:46:47 -0400 Subject: [PATCH 2/3] Only test function-arguments-naked.rs on x86_64 We need to use inline assembly, which is inherently platform-specific. --- src/test/debuginfo/function-arguments-naked.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/debuginfo/function-arguments-naked.rs b/src/test/debuginfo/function-arguments-naked.rs index f8e6253448a3f..f6919d6f7f77d 100644 --- a/src/test/debuginfo/function-arguments-naked.rs +++ b/src/test/debuginfo/function-arguments-naked.rs @@ -3,6 +3,9 @@ // We have to ignore android because of this issue: // https://github.com/rust-lang/rust/issues/74847 // ignore-android +// +// We need to use inline assembly, so just use one platform +// only-x86_64 // compile-flags:-g @@ -24,6 +27,7 @@ // lldb-command:continue +#![feature(asm)] #![feature(naked_functions)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -34,5 +38,5 @@ fn main() { #[naked] fn naked(x: usize, y: usize) { - // #break + unsafe { asm!("ret"); } // #break } From c34c77c764491460449a6bef06b2149c3ab82f2d Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Fri, 7 Aug 2020 09:51:50 -0400 Subject: [PATCH 3/3] Apply `extern "C"` calling convention Co-authored-by: Amanieu d'Antras --- src/test/debuginfo/function-arguments-naked.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/debuginfo/function-arguments-naked.rs b/src/test/debuginfo/function-arguments-naked.rs index f6919d6f7f77d..5f3a1eb44e4e5 100644 --- a/src/test/debuginfo/function-arguments-naked.rs +++ b/src/test/debuginfo/function-arguments-naked.rs @@ -37,6 +37,6 @@ fn main() { } #[naked] -fn naked(x: usize, y: usize) { +extern "C" fn naked(x: usize, y: usize) { unsafe { asm!("ret"); } // #break }