Do not use OCAMLPARAM objects with -a and -pack

We add a flag 'with_ocamlparam' to the get_objfiles function.
master
Marc Lasson 2016-05-18 13:50:55 +02:00
parent 65722c5ba1
commit 210d7aeafa
4 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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 ->

View File

@ -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 ->