diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2025-05-10 18:26:57 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2025-05-11 14:38:42 +1000 |
| commit | b1094f6a0a489bb1bc2be6ca17d2bec269bd9364 (patch) | |
| tree | 1955bd2300730b3468d2c2640437fb312427869b /compiler/rustc_codegen_llvm/src/llvm/mod.rs | |
| parent | d1bb310a7aa54b4bfc68c6960e1de0976ff447a5 (diff) | |
| download | rust-b1094f6a0a489bb1bc2be6ca17d2bec269bd9364.tar.gz rust-b1094f6a0a489bb1bc2be6ca17d2bec269bd9364.zip | |
Add a safe wrapper for `LLVMAppendModuleInlineAsm`
This patch also changes the Rust-side declaration to take `*const c_uchar` instead of `*const c_char`, to avoid the need for `AsCCharPtr`.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/mod.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs index d14aab06073..7dbcfb508ce 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs @@ -440,3 +440,11 @@ pub(crate) fn set_dso_local<'ll>(v: &'ll Value) { LLVMRustSetDSOLocal(v, true); } } + +/// Safe wrapper for `LLVMAppendModuleInlineAsm`, which delegates to +/// `Module::appendModuleInlineAsm`. +pub(crate) fn append_module_inline_asm<'ll>(llmod: &'ll Module, asm: &[u8]) { + unsafe { + LLVMAppendModuleInlineAsm(llmod, asm.as_ptr(), asm.len()); + } +} |
