summaryrefslogtreecommitdiff
path: root/bytecomp
diff options
context:
space:
mode:
authorDavid Allsopp <david.allsopp@metastack.com>2018-11-22 15:08:32 +0000
committerDamien Doligez <damien.doligez@gmail.com>2019-02-01 16:18:53 +0100
commit611fa6e8f8b398cd37821edd109f1ba35e2c2fff (patch)
tree5b5362ac890507c5a981122acefd59ae41e0af60 /bytecomp
parent87140572a3a0315bcbb9bafda330d67ee04cac3a (diff)
downloadocaml-611fa6e8f8b398cd37821edd109f1ba35e2c2fff.tar.gz
Fix -compat-32 error message in -custom mode
In -custom mode, then bytecode executable is first made in /tmp and this filename leaked if the executable fails the -compat-32 test.
Diffstat (limited to 'bytecomp')
-rw-r--r--bytecomp/bytelink.ml7
1 files changed, 4 insertions, 3 deletions
diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml
index d167d7d176..17d35d35f7 100644
--- a/bytecomp/bytelink.ml
+++ b/bytecomp/bytelink.ml
@@ -292,7 +292,8 @@ let make_absolute file =
(* Create a bytecode executable file *)
-let link_bytecode tolink exec_name standalone =
+let link_bytecode ?final_name tolink exec_name standalone =
+ let final_name = Option.value final_name ~default:exec_name in
(* Avoid the case where the specified exec output file is the same as
one of the objects to be linked *)
List.iter (function
@@ -361,7 +362,7 @@ let link_bytecode tolink exec_name standalone =
Bytesections.record outchan "PRIM";
(* The table of global data *)
Emitcode.marshal_to_channel_with_possibly_32bit_compat
- ~filename:exec_name ~kind:"bytecode executable"
+ ~filename:final_name ~kind:"bytecode executable"
outchan (Symtable.initial_global_table());
Bytesections.record outchan "DATA";
(* The map of global identifiers *)
@@ -586,7 +587,7 @@ let link objfiles output_name =
remove_file bytecode_name;
if not !Clflags.keep_camlprimc_file then remove_file prim_name)
(fun () ->
- link_bytecode tolink bytecode_name false;
+ link_bytecode ~final_name:output_name tolink bytecode_name false;
let poc = open_out prim_name in
(* note: builds will not be reproducible if the C code contains macros
such as __FILE__. *)