@@ -304,14 +304,15 @@ let link_bytecode ?final_name tolink exec_name standalone =
304304 raise (Error (Wrong_object_name exec_name));
305305 | _ -> () ) tolink;
306306 Misc. remove_file exec_name; (* avoid permission problems, cf PR#8354 *)
307+ let outperm = if ! Clflags. with_runtime then 0o777 else 0o666 in
307308 let outchan =
308309 open_out_gen [Open_wronly ; Open_trunc ; Open_creat ; Open_binary ]
309- 0o777 exec_name in
310+ outperm exec_name in
310311 Misc. try_finally
311312 ~always: (fun () -> close_out outchan)
312313 ~exceptionally: (fun () -> remove_file exec_name)
313314 (fun () ->
314- if standalone then begin
315+ if standalone && ! Clflags. with_runtime then begin
315316 (* Copy the header *)
316317 let header =
317318 if String. length ! Clflags. use_runtime > 0
@@ -327,7 +328,8 @@ let link_bytecode ?final_name tolink exec_name standalone =
327328 end ;
328329 Bytesections. init_record outchan;
329330 (* The path to the bytecode interpreter (in use_runtime mode) *)
330- if String. length ! Clflags. use_runtime > 0 then begin
331+ if String. length ! Clflags. use_runtime > 0 && ! Clflags. with_runtime then
332+ begin
331333 let runtime = make_absolute ! Clflags. use_runtime in
332334 let runtime =
333335 (* shebang mustn't exceed 128 including the #! and \0 *)
@@ -541,7 +543,10 @@ let link_bytecode_as_c tolink outfile =
541543(* Build a custom runtime *)
542544
543545let build_custom_runtime prim_name exec_name =
544- let runtime_lib = " -lcamlrun" ^ ! Clflags. runtime_variant in
546+ let runtime_lib =
547+ if not ! Clflags. with_runtime
548+ then " "
549+ else " -lcamlrun" ^ ! Clflags. runtime_variant in
545550 let debug_prefix_map =
546551 if Config. c_has_debug_prefix_map && not ! Clflags. keep_camlprimc_file then
547552 [Printf. sprintf " -fdebug-prefix-map=%s=camlprim.c" prim_name]
@@ -665,7 +670,10 @@ let link objfiles output_name =
665670 else Ccomp. MainDll , Config. bytecomp_c_libraries
666671 in
667672 if not (
668- let runtime_lib = " -lcamlrun" ^ ! Clflags. runtime_variant in
673+ let runtime_lib =
674+ if not ! Clflags. with_runtime
675+ then " "
676+ else " -lcamlrun" ^ ! Clflags. runtime_variant in
669677 Ccomp. call_linker mode output_name
670678 ([obj_file] @ List. rev ! Clflags. ccobjs @ [runtime_lib])
671679 c_libs
0 commit comments