You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #135648 - folkertdev:naked-asm-wasm, r=bjorn3
support wasm inline assembly in `naked_asm!`
fixes#135518
Webassembly was overlooked previously, but now `naked_asm!` and `#[naked]` functions work on the webassembly targets.
Or, they almost do right now. I guess this is no surprise, but the `wasm32-unknown-unknown` target causes me some trouble. I'll add some inline comments with more details.
r? ```````@bjorn3```````
cc ```````@daxpedda,``````` ```````@tgross35```````
let ptr_type = match tcx.data_layout.pointer_size.bits(){
313
+
32 => "i32",
314
+
64 => "i64",
315
+
other => bug!("wasm pointer size cannot be {other} bits"),
316
+
};
317
+
318
+
// FIXME: remove this once the wasm32-unknown-unknown ABI is fixed
319
+
// please also add `wasm32-unknown-unknown` back in `tests/assembly/wasm32-naked-fn.rs`
320
+
// basically the commit introducing this comment should be reverted
321
+
ifletPassMode::Pair{ .. } = fn_abi.ret.mode{
322
+
let _ = WasmCAbi::Legacy;
323
+
span_bug!(
324
+
tcx.def_span(def_id),
325
+
"cannot return a pair (the wasm32-unknown-unknown ABI is broken, see https://github.com/rust-lang/rust/issues/115666"
326
+
);
327
+
}
328
+
329
+
let hidden_return = matches!(fn_abi.ret.mode,PassMode::Indirect{ .. });
// FIXME: remove this branch once the wasm32-unknown-unknown ABI is fixed
374
+
let _ = WasmCAbi::Legacy;
375
+
span_bug!(
376
+
tcx.def_span(def_id),
377
+
"cannot use memory args (the wasm32-unknown-unknown ABI is broken, see https://github.com/rust-lang/rust/issues/115666"
378
+
);
379
+
}
380
+
other => unreachable!("unexpected BackendRepr: {:?}", other),
381
+
};
382
+
383
+
signature.push_str(direct_type);
384
+
}
385
+
PassMode::Pair(_, _) => match arg_abi.layout.backend_repr{
0 commit comments