Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call linker even when Clflags.objfiles is empty #8877

Merged
merged 2 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion driver/compenv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ let get_objfiles ~with_ocamlparam =
else
List.rev !objfiles

let has_linker_inputs = ref false



Expand Down Expand Up @@ -653,8 +654,10 @@ let process_action
else if Filename.check_suffix name ".cmi" && !make_package then
objfiles := name :: !objfiles
else if Filename.check_suffix name Config.ext_obj
|| Filename.check_suffix name Config.ext_lib then
|| Filename.check_suffix name Config.ext_lib then begin
has_linker_inputs := true;
ccobjs := name :: !ccobjs
end
else if not !native_code && Filename.check_suffix name Config.ext_dll then
dllibs := name :: !dllibs
else
Expand Down
1 change: 1 addition & 0 deletions driver/compenv.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ val last_objfiles : string list ref
val first_objfiles : string list ref

val stop_early : bool ref
val has_linker_inputs : bool ref

type filename = string

Expand Down
3 changes: 2 additions & 1 deletion driver/optmaindriver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ let main argv ppf =
(Compenv.get_objfiles ~with_ocamlparam:false) target);
Warnings.check_fatal ();
end
else if not !Compenv.stop_early && !objfiles <> [] then begin
else if not !Compenv.stop_early &&
(!objfiles <> [] || !Compenv.has_linker_inputs) then begin
let target =
if !output_c_object then
let s = Compenv.extract_output !output_name in
Expand Down