[m-rev.] diff: fix `mmc --make' link object order
Simon Taylor
stayl at cs.mu.OZ.AU
Wed May 22 04:57:51 AEST 2002
Estimated hours taken: 0.25
Branches: main
compiler/make.program_target.m:
MLOBJS or `--link-objects' may contain `.a' files, which
should come last on the linker command line.
Index: make.program_target.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make.program_target.m,v
retrieving revision 1.4
diff -u -u -r1.4 make.program_target.m
--- make.program_target.m 13 May 2002 18:22:24 -0000 1.4
+++ make.program_target.m 21 May 2002 18:46:54 -0000
@@ -163,7 +163,7 @@
AllModules, ObjModules, CompilationTarget, ObjExtToUse,
DepsSuccess, BuildDepsResult, ErrorStream, Succeeded,
Info0, Info) -->
- globals__io_lookup_accumulating_option(link_objects, ExtraObjects0),
+ globals__io_lookup_accumulating_option(link_objects, LinkObjects),
% Clear the option -- we'll pass the list of files directly.
globals__io_set_option(link_objects, accumulating([])),
@@ -188,24 +188,25 @@
{ Info1 = Info0 ^ file_timestamps :=
map__delete(Info0 ^ file_timestamps,
InitObject) },
- { ExtraObjects = [InitObject | ExtraObjects0] },
+ { InitObjects = [InitObject] },
{ DepsResult2 = BuildDepsResult }
;
{ InitObjectResult = no },
{ Info1 = Info0 },
{ DepsResult2 = error },
- { ExtraObjects = ExtraObjects0 }
+ { InitObjects = [] }
)
;
{ DepsResult2 = BuildDepsResult },
{ Info1 = Info0 },
- { ExtraObjects = ExtraObjects0 }
+ { InitObjects = [] }
),
+ { ObjectsToCheck = InitObjects ++ LinkObjects },
list__map_foldl2(get_file_timestamp([dir__this_directory]),
- ExtraObjects, ExtraObjectTimestamps, Info1, Info2),
+ ObjectsToCheck, ExtraObjectTimestamps, Info1, Info2),
check_dependency_timestamps(OutputFileName, MaybeTimestamp,
- ExtraObjects, io__write, ExtraObjectTimestamps,
+ ObjectsToCheck, io__write, ExtraObjectTimestamps,
ExtraObjectDepsResult),
{ DepsResult3 = ( DepsSuccess = yes -> DepsResult2 ; error ) },
@@ -251,14 +252,17 @@
{ ForeignObjects = list__map(
(func(foreign_code_file(_, _, ObjFile)) = ObjFile),
list__condense(ExtraForeignFiles)) },
- { AllExtraObjects = ExtraObjects ++ ForeignObjects },
list__map_foldl(
(pred(ObjModule::in, ObjToLink::out, di, uo) is det -->
module_name_to_file_name(ObjModule,
ObjExtToUse, no, ObjToLink)
), ObjModules, ObjList),
- { AllObjects = AllExtraObjects ++ ObjList },
+
+ % LinkObjects may contain `.a' files which must come
+ % after all the object files on the linker command line.
+ { AllObjects = InitObjects ++ ObjList ++
+ ForeignObjects ++ LinkObjects },
(
{ CompilationTarget = c },
@@ -298,7 +302,7 @@
{ Info = Info3 }
)
),
- globals__io_set_option(link_objects, accumulating(ExtraObjects0)).
+ globals__io_set_option(link_objects, accumulating(LinkObjects)).
:- pred linked_target_cleanup(module_name::in, linked_target_type::in,
file_name::in, compilation_target::in, make_info::in, make_info::out,
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list