rustc: Declare rust_start as a function

Issue #2167
This commit is contained in:
Haitao Li 2012-04-09 12:02:16 +08:00
parent 9e1e42d750
commit 460b92a37f

View File

@ -4497,9 +4497,7 @@ fn create_entry_fn(ccx: @crate_ctxt, rust_main: ValueRef) {
let crate_map = ccx.crate_map; let crate_map = ccx.crate_map;
let start_ty = T_fn([val_ty(rust_main), ccx.int_type, ccx.int_type, let start_ty = T_fn([val_ty(rust_main), ccx.int_type, ccx.int_type,
val_ty(crate_map)], ccx.int_type); val_ty(crate_map)], ccx.int_type);
let start = str::as_c_str("rust_start", {|buf| let start = decl_cdecl_fn(ccx.llmod, "rust_start", start_ty);
llvm::LLVMAddGlobal(ccx.llmod, start_ty, buf)
});
let args = [rust_main, llvm::LLVMGetParam(llfn, 0 as c_uint), let args = [rust_main, llvm::LLVMGetParam(llfn, 0 as c_uint),
llvm::LLVMGetParam(llfn, 1 as c_uint), crate_map]; llvm::LLVMGetParam(llfn, 1 as c_uint), crate_map];
let result = unsafe { let result = unsafe {