fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
fn LLVMGetPreviousFunction(Fn: ValueRef) -> ValueRef;
fn LLVMDeleteFunction(Fn: ValueRef);
+ fn LLVMGetOrInsertFunction(M: ModuleRef, Name: sbuf, FunctionTy: TypeRef)
+ -> ValueRef;
fn LLVMGetIntrinsicID(Fn: ValueRef) -> uint;
fn LLVMGetFunctionCallConv(Fn: ValueRef) -> uint;
fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: uint);
fn decl_fn(llmod: ModuleRef, name: str, cc: uint, llty: TypeRef) -> ValueRef {
let llfn: ValueRef =
- str::as_buf(name, {|buf| llvm::LLVMAddFunction(llmod, buf, llty) });
+ str::as_buf(name, {|buf|
+ llvm::LLVMGetOrInsertFunction(llmod, buf, llty) });
llvm::LLVMSetFunctionCallConv(llfn, cc);
ret llfn;
}
EnableSegmentedStacks = true;
}
+extern "C" LLVMValueRef LLVMGetOrInsertFunction(LLVMModuleRef M,
+ const char* Name,
+ LLVMTypeRef FunctionTy) {
+ return wrap(unwrap(M)->getOrInsertFunction(Name,
+ unwrap<FunctionType>(FunctionTy)));
+}
LLVMGetNextUse
LLVMGetNumOperands
LLVMGetOperand
+LLVMGetOrInsertFunction
LLVMGetParam
LLVMGetParamParent
LLVMGetParamTypes
--- /dev/null
+native "cdecl" mod rustrt1 = "rustrt" {
+ fn pin_task();
+}
+
+native "cdecl" mod rustrt2 = "rustrt" {
+ fn pin_task();
+}
+
+fn main() {
+ rustrt1::pin_task();
+ rustrt2::pin_task();
+}