Skip to content

Commit f44a689

Browse files
committed
Expose LLVM appendModuleInlineAsm
1 parent b068d38 commit f44a689

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/librustc_llvm/ffi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ extern "C" {
507507

508508
/// See Module::setModuleInlineAsm.
509509
pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
510+
pub fn LLVMRustAppendModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
510511

511512
/// See llvm::LLVMTypeKind::getTypeID.
512513
pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;

src/librustc_trans/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ pub fn trans_global_asm<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
129129
ga: &hir::GlobalAsm) {
130130
let asm = CString::new(ga.asm.as_str().as_bytes()).unwrap();
131131
unsafe {
132-
llvm::LLVMSetModuleInlineAsm(ccx.llmod(), asm.as_ptr());
132+
llvm::LLVMRustAppendModuleInlineAsm(ccx.llmod(), asm.as_ptr());
133133
}
134134
}

src/rustllvm/RustWrapper.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ extern "C" LLVMValueRef LLVMRustInlineAsm(LLVMTypeRef Ty, char *AsmString,
312312
HasSideEffects, IsAlignStack, fromRust(Dialect)));
313313
}
314314

315+
extern "C" void LLVMRustAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm) {
316+
unwrap(M)->appendModuleInlineAsm(StringRef(Asm));
317+
}
318+
315319
typedef DIBuilder *LLVMRustDIBuilderRef;
316320

317321
typedef struct LLVMOpaqueMetadata *LLVMRustMetadataRef;

0 commit comments

Comments
 (0)