diff options
author | Nicolás Ojeda Bär <n.oje.bar@gmail.com> | 2020-04-25 13:01:03 +0200 |
---|---|---|
committer | Nicolás Ojeda Bär <n.oje.bar@gmail.com> | 2020-04-25 13:02:58 +0200 |
commit | 13e410311ed3ee3cb72ca2cf967146dad38f44c5 (patch) | |
tree | 9906d5342c992f0a183e07d215ccdb57075f5c87 /bytecomp | |
parent | ce4cdaa86c1595ad99f8436d6e953daa8f24d819 (diff) | |
download | ocaml-13e410311ed3ee3cb72ca2cf967146dad38f44c5.tar.gz |
Link std_exit.cmo into binaries compiled with -output-complete-exe (#9495)
(cherry picked from commit 1e98c52e9359e79633959604034a6634ca264b91)
Diffstat (limited to 'bytecomp')
-rw-r--r-- | bytecomp/bytelink.ml | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml index 1260f5bd0f..d980054ced 100644 --- a/bytecomp/bytelink.ml +++ b/bytecomp/bytelink.ml @@ -511,6 +511,7 @@ let link_bytecode_as_c tolink outfile with_main = \n caml_sections, sizeof(caml_sections),\ \n /* pooling */ 0,\ \n argv);\ +\n caml_sys_exit(Val_int(0));\ \n return 0; /* not reached */\ \n}\n" end else begin @@ -595,9 +596,15 @@ let fix_exec_name name = let link objfiles output_name = let objfiles = - if !Clflags.nopervasives then objfiles - else if !Clflags.output_c_object then "stdlib.cma" :: objfiles - else "stdlib.cma" :: (objfiles @ ["std_exit.cmo"]) in + match + !Clflags.nopervasives, + !Clflags.output_c_object, + !Clflags.output_complete_executable + with + | true, _, _ -> objfiles + | false, true, false -> "stdlib.cma" :: objfiles + | _ -> "stdlib.cma" :: objfiles @ ["std_exit.cmo"] + in let tolink = List.fold_right scan_file objfiles [] in let missing_modules = Ident.Set.filter (fun id -> not (Ident.is_predef id)) !missing_globals |