File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 8ebf72ed29f7f6cb35051d766ba9900509f4aaa1
2
+ refs/heads/master: 22eca31d98ce3e1bc5690799e669911e4d06a5aa
Original file line number Diff line number Diff line change @@ -366,7 +366,6 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
366
366
acyclic-unwind.rs \
367
367
alt-pattern-simple.rs \
368
368
alt-tag.rs \
369
- argv.rs \
370
369
basic.rs \
371
370
bind-obj-ctor.rs \
372
371
bind-thunk.rs \
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ type abi = {
11
11
12
12
let declare_abi (llctx :Llvm.llcontext ) (llmod :Llvm.llmodule ) : abi =
13
13
let i32 = Llvm. i32_type llctx in
14
+ (* FIXME: Use Llvm_target.intptr_type for more platform support. *)
15
+ let word_ty = i32 in
14
16
15
17
let crate_ty =
16
18
(* TODO: other architectures besides x86 *)
@@ -51,19 +53,16 @@ let declare_abi (llctx:Llvm.llcontext) (llmod:Llvm.llmodule) : abi =
51
53
ignore (Llvm. define_type_name " rust_task" task_ty llmod);
52
54
53
55
let rust_start_ty =
54
- let task_ptr_ty = Llvm. pointer_type task_ty in
55
- let llnilty = Llvm. array_type (Llvm. i1_type llctx) 0 in
56
- let main_ty = Llvm. function_type (Llvm. void_type llctx)
57
- [| Llvm. pointer_type llnilty; task_ptr_ty; |]
58
- in
59
- let args_ty = Array. map Llvm. pointer_type [| main_ty; crate_ty; |] in
60
- let args_ty = Array. append args_ty [| i32; i32 |] in
56
+ (* Rust's main function can have several types, so we cast them
57
+ all to uintptr_t. *)
58
+ let main_ty = word_ty in
59
+ let args_ty = [| main_ty; Llvm. pointer_type crate_ty; i32; i32 |] in
61
60
Llvm. function_type i32 args_ty
62
61
in
63
62
{
64
63
crate_ty = crate_ty;
65
64
task_ty = task_ty;
66
- word_ty = i32 ;
65
+ word_ty = word_ty ;
67
66
rust_start = Llvm. declare_function " rust_start" rust_start_ty llmod
68
67
}
69
68
;;
Original file line number Diff line number Diff line change @@ -79,7 +79,8 @@ let finalize_module
79
79
| Some fn -> fn
80
80
in
81
81
let rust_start = abi.Llabi. rust_start in
82
- let rust_start_args = [| rust_main_fn; crate_ptr; argc; argv |] in
82
+ let rust_start_args = [| Llvm. const_ptrtoint rust_main_fn abi.Llabi. word_ty;
83
+ crate_ptr; argc; argv |] in
83
84
ignore (Llvm. build_call
84
85
rust_start rust_start_args " start_rust" main_builder);
85
86
ignore (Llvm. build_ret (Llvm. const_int i32 0 ) main_builder)
You can’t perform that action at this time.
0 commit comments