Enable inline asm on macOS

This commit is contained in:
bjorn3
2022-08-12 12:30:24 +00:00
parent e45f6000a0
commit f76ca22479
3 changed files with 15 additions and 11 deletions
+1 -3
View File
@@ -52,9 +52,7 @@ configuration options.
## Not yet supported
* Inline assembly ([no cranelift support](https://github.com/bytecodealliance/wasmtime/issues/1041))
* On Linux there is support for invoking an external assembler for `global_asm!` and `asm!`.
`llvm_asm!` will remain unimplemented forever. `asm!` doesn't yet support reg classes. You
have to specify specific registers instead.
* On UNIX there is support for invoking an external assembler for `global_asm!` and `asm!`.
* SIMD ([tracked here](https://github.com/bjorn3/rustc_codegen_cranelift/issues/171), some basic things work)
## License
+12 -2
View File
@@ -321,7 +321,7 @@ struct ExternTypeWrapper {
#[cfg(not(any(jit, windows)))]
test_tls();
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "linux"))]
#[cfg(all(not(jit), target_arch = "x86_64", any(target_os = "linux", target_os = "darwin")))]
unsafe {
global_asm_test();
}
@@ -343,7 +343,7 @@ fn main() {
}
}
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "linux"))]
#[cfg(all(not(jit), target_arch = "x86_64", any(target_os = "linux", target_os = "darwin")))]
extern "C" {
fn global_asm_test();
}
@@ -358,6 +358,16 @@ fn main() {
"
}
#[cfg(all(not(jit), target_arch = "x86_64", target_os = "darwin"))]
global_asm! {
"
.global _global_asm_test
_global_asm_test:
// comment that would normally be removed by LLVM
ret
"
}
#[repr(C)]
enum c_void {
_1,
+2 -6
View File
@@ -41,9 +41,7 @@ pub(crate) struct GlobalAsmConfig {
impl GlobalAsmConfig {
pub(crate) fn new(tcx: TyCtxt<'_>) -> Self {
let asm_enabled = cfg!(feature = "inline_asm")
&& !tcx.sess.target.is_like_osx
&& !tcx.sess.target.is_like_windows;
let asm_enabled = cfg!(feature = "inline_asm") && !tcx.sess.target.is_like_windows;
GlobalAsmConfig {
asm_enabled,
@@ -74,9 +72,7 @@ pub(crate) fn compile_global_asm(
.to_owned(),
);
} else {
return Err(
"asm! and global_asm! are not yet supported on macOS and Windows".to_owned()
);
return Err("asm! and global_asm! are not yet supported on Windows".to_owned());
}
}