about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/inline_asm.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/inline_asm.rs b/src/inline_asm.rs
index 0517c609337..b2e27399055 100644
--- a/src/inline_asm.rs
+++ b/src/inline_asm.rs
@@ -45,6 +45,14 @@ pub(crate) fn codegen_inline_asm<'tcx>(
 ) {
     // FIXME add .eh_frame unwind info directives
 
+    // Used by panic_abort on Windows, but uses a syntax which only happens to work with
+    // asm!() by accident and breaks with the GNU assembler as well as global_asm!() for
+    // the LLVM backend.
+    if template[0] == InlineAsmTemplatePiece::String("int $$0x29".to_string()) {
+        fx.bcx.ins().trap(TrapCode::User(1));
+        return;
+    }
+
     if !asm_supported(fx.tcx) {
         if template.is_empty() {
             let destination_block = fx.get_block(destination.unwrap());
@@ -52,12 +60,6 @@ pub(crate) fn codegen_inline_asm<'tcx>(
             return;
         }
 
-        // Used by panic_abort
-        if template[0] == InlineAsmTemplatePiece::String("int $$0x29".to_string()) {
-            fx.bcx.ins().trap(TrapCode::User(1));
-            return;
-        }
-
         // Used by stdarch
         if template[0] == InlineAsmTemplatePiece::String("mov ".to_string())
             && matches!(