mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Enable inline asm on macOS
This commit is contained in:
parent
e45f6000a0
commit
f76ca22479
@ -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
|
||||
|
@ -321,7 +321,7 @@ fn main() {
|
||||
#[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 @@ global_asm! {
|
||||
"
|
||||
}
|
||||
|
||||
#[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,
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user