Skip to content

Commit b1e7051

Browse files
committed
Unconditionally handle int $$0x29 using a shim
1 parent 827a6d8 commit b1e7051

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/inline_asm.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,21 @@ pub(crate) fn codegen_inline_asm<'tcx>(
4545
) {
4646
// FIXME add .eh_frame unwind info directives
4747

48+
// Used by panic_abort on Windows, but uses a syntax which only happens to work with
49+
// asm!() by accident and breaks with the GNU assembler as well as global_asm!() for
50+
// the LLVM backend.
51+
if template[0] == InlineAsmTemplatePiece::String("int $$0x29".to_string()) {
52+
fx.bcx.ins().trap(TrapCode::User(1));
53+
return;
54+
}
55+
4856
if !asm_supported(fx.tcx) {
4957
if template.is_empty() {
5058
let destination_block = fx.get_block(destination.unwrap());
5159
fx.bcx.ins().jump(destination_block, &[]);
5260
return;
5361
}
5462

55-
// Used by panic_abort
56-
if template[0] == InlineAsmTemplatePiece::String("int $$0x29".to_string()) {
57-
fx.bcx.ins().trap(TrapCode::User(1));
58-
return;
59-
}
60-
6163
// Used by stdarch
6264
if template[0] == InlineAsmTemplatePiece::String("mov ".to_string())
6365
&& matches!(

0 commit comments

Comments
 (0)