From c22bd1969cf93db50ed40bcee91bb34fdec5640f Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 5 Sep 2024 17:14:17 +0200 Subject: [PATCH] check that assembler mode restored --- compiler/rustc_codegen_ssa/src/mir/naked_asm.rs | 2 +- tests/codegen/naked-fn/instruction-set.rs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs index 86990cc99011d..b7df2919b1089 100644 --- a/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs +++ b/compiler/rustc_codegen_ssa/src/mir/naked_asm.rs @@ -138,8 +138,8 @@ fn prefix_and_suffix<'tcx>( true => ".thumb\n.thumb_func", false => ".arm", }, - Some(InstructionSetAttr::ArmA32) => ".arm", Some(InstructionSetAttr::ArmT32) => ".thumb\n.thumb_func", + Some(InstructionSetAttr::ArmA32) => ".arm", }, match is_thumb { true => ".thumb", diff --git a/tests/codegen/naked-fn/instruction-set.rs b/tests/codegen/naked-fn/instruction-set.rs index 509c24f9457cf..5d6637bcb26b0 100644 --- a/tests/codegen/naked-fn/instruction-set.rs +++ b/tests/codegen/naked-fn/instruction-set.rs @@ -15,7 +15,9 @@ trait Sized {} #[lang = "copy"] trait Copy {} +// CHECK: .arm // CHECK-LABEL: test_unspecified: +// CHECK: bx lr // CHECK: .arm #[no_mangle] #[naked] @@ -23,9 +25,11 @@ unsafe extern "C" fn test_unspecified() { asm!("bx lr", options(noreturn)); } -// CHECK-LABEL: test_thumb: // CHECK: .thumb // CHECK: .thumb_func +// CHECK-LABEL: test_thumb: +// CHECK: bx lr +// CHECK: .arm #[no_mangle] #[naked] #[instruction_set(arm::t32)] @@ -33,11 +37,13 @@ unsafe extern "C" fn test_thumb() { asm!("bx lr", options(noreturn)); } +// CHECK: .arm // CHECK-LABEL: test_arm: +// CHECK: bx lr // CHECK: .arm #[no_mangle] #[naked] -#[instruction_set(arm::t32)] +#[instruction_set(arm::a32)] unsafe extern "C" fn test_arm() { asm!("bx lr", options(noreturn)); }