diff --git a/driver/compenv.ml b/driver/compenv.ml index d9d7779e5..1e4524952 100644 --- a/driver/compenv.ml +++ b/driver/compenv.ml @@ -522,5 +522,8 @@ let readenv ppf position = all_ccopts := !last_ccopts @ !first_ccopts; all_ppx := !last_ppx @ !first_ppx -let get_objfiles () = - List.rev (!last_objfiles @ !objfiles @ !first_objfiles) +let get_objfiles ~with_ocamlparam = + if with_ocamlparam then + List.rev (!last_objfiles @ !objfiles @ !first_objfiles) + else + List.rev !objfiles diff --git a/driver/compenv.mli b/driver/compenv.mli index 413420d42..24e5ff8c9 100644 --- a/driver/compenv.mli +++ b/driver/compenv.mli @@ -31,7 +31,7 @@ val last_include_dirs : string list ref val implicit_modules : string list ref (* return the list of objfiles, after OCAMLPARAM and List.rev *) -val get_objfiles : unit -> string list +val get_objfiles : with_ocamlparam:bool -> string list type filename = string diff --git a/driver/main.ml b/driver/main.ml index 3bfd8f3df..2035bb1a1 100644 --- a/driver/main.ml +++ b/driver/main.ml @@ -182,14 +182,14 @@ let main () = if !make_archive then begin Compmisc.init_path false; - Bytelibrarian.create_archive ppf (Compenv.get_objfiles ()) + Bytelibrarian.create_archive ppf (Compenv.get_objfiles ~with_ocamlparam:false) (extract_output !output_name); Warnings.check_fatal (); end else if !make_package then begin Compmisc.init_path false; let extracted_output = extract_output !output_name in - let revd = get_objfiles () in + let revd = get_objfiles ~with_ocamlparam:false in Bytepackager.package_files ppf (Compmisc.initial_env ()) revd (extracted_output); Warnings.check_fatal (); @@ -212,7 +212,7 @@ let main () = default_output !output_name in Compmisc.init_path false; - Bytelink.link ppf (get_objfiles ()) target; + Bytelink.link ppf (get_objfiles ~with_ocamlparam:true) target; Warnings.check_fatal (); end; with x -> diff --git a/driver/optmain.ml b/driver/optmain.ml index 91bde7b65..a6c78c308 100644 --- a/driver/optmain.ml +++ b/driver/optmain.ml @@ -293,20 +293,20 @@ let main () = fatal "Option -a cannot be used with .cmxa input files."; Compmisc.init_path true; let target = extract_output !output_name in - Asmlibrarian.create_archive (get_objfiles ()) target; + Asmlibrarian.create_archive (get_objfiles ~with_ocamlparam:false) target; Warnings.check_fatal (); end else if !make_package then begin Compmisc.init_path true; let target = extract_output !output_name in Asmpackager.package_files ppf (Compmisc.initial_env ()) - (get_objfiles ()) target ~backend; + (get_objfiles ~with_ocamlparam:false) target ~backend; Warnings.check_fatal (); end else if !shared then begin Compmisc.init_path true; let target = extract_output !output_name in - Asmlink.link_shared ppf (get_objfiles ()) target; + Asmlink.link_shared ppf (get_objfiles ~with_ocamlparam:false) target; Warnings.check_fatal (); end else if not !compile_only && !objfiles <> [] then begin @@ -326,7 +326,7 @@ let main () = default_output !output_name in Compmisc.init_path true; - Asmlink.link ppf (get_objfiles ()) target; + Asmlink.link ppf (get_objfiles ~with_ocamlparam:true) target; Warnings.check_fatal (); end; with x ->