Skip to content

Commit cae81d4

Browse files
committed
---
yaml --- r: 895 b: refs/heads/master c: 049072d h: refs/heads/master i: 893: 02134fd 891: b73bb95 887: 67e062c 879: a56e4b8 863: 735079e 831: b3e7c8b 767: bcfd006 v: v3
1 parent c1a653b commit cae81d4

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 216082d0405c36e63f602462bb119a3c3b4a488d
2+
refs/heads/master: 049072db824b7eeb4246fd75fa82b2837c00f9d3

trunk/src/boot/llvm/llasm.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let x86_glue
2626
let (prefix,align) =
2727
match sess.Session.sess_targ with
2828
Linux_x86_elf
29-
| Win32_x86_pe -> ("",4)
29+
| Win32_x86_pe -> ("_",4)
3030
| MacOS_x86_macho -> ("_", 16)
3131
in
3232
let save_callee_saves =

trunk/src/boot/llvm/llfinal.ml

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*)
55

66
let finalize_module
7+
(sess:Session.sess)
78
(llctx:Llvm.llcontext)
89
(llmod:Llvm.llmodule)
910
(abi:Llabi.abi)
@@ -68,7 +69,13 @@ let finalize_module
6869
(* Define the main function for crt0 to call. *)
6970
let main_fn =
7071
let main_ty = Llvm.function_type i32 [| i32; i32 |] in
71-
Llvm.define_function "main" main_ty llmod
72+
let main_name =
73+
match sess.Session.sess_targ with
74+
Common.Win32_x86_pe -> "WinMain@16"
75+
| Common.Linux_x86_elf
76+
| Common.MacOS_x86_macho -> "main"
77+
in
78+
Llvm.define_function main_name main_ty llmod
7279
in
7380
let argc = Llvm.param main_fn 0 in
7481
let argv = Llvm.param main_fn 1 in

trunk/src/boot/llvm/lltrans.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ let trans_crate
11321132
Hashtbl.iter declare_mod_item items;
11331133
Hashtbl.iter trans_mod_item items;
11341134
Llfinal.finalize_module
1135-
llctx llmod abi asm_glue exit_task_glue crate_ptr;
1135+
sess llctx llmod abi asm_glue exit_task_glue crate_ptr;
11361136
llmod
11371137
with e -> Llvm.dispose_module llmod; raise e
11381138
;;

0 commit comments

Comments
 (0)