[m-dev.] diff: avoid overflowing command line for .split.a targets
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Oct 20 15:02:18 AEST 1999
The tests failed on munta, because the commands to create
the --split-c-files version of the library failed due to
overflowing a command line limit. Even worse, the error
did not cause things to fail immediately; it just created
an incomplete library, leading to link errors later on.
My first thought was the following patch:
compiler/modules.m:
Fix a bug in the rule generated for creating the .split.a file:
if `ar' fails, then exit, rather than ignoring the error.
Workspace: /d-drive/home/hg/fjh/mercury
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.108
diff -u -d -r1.108 modules.m
--- compiler/modules.m 1999/09/12 04:26:46 1.108
+++ compiler/modules.m 1999/10/20 02:46:39
@@ -2563,7 +2563,7 @@
"\trm -f ", SplitLibFileName, "\n",
"\t$(AR) $(ALL_ARFLAGS) ", SplitLibFileName, " $(MLOBJS)\n",
"\tfor dir in $(", MakeVarName, ".dirs); do \\\n",
- "\t $(AR) q ", SplitLibFileName, " $$dir/*.o; \\\n",
+ "\t $(AR) q ", SplitLibFileName, " $$dir/*.o || exit 1; \\\n",
"\tdone\n",
"\t$(RANLIB) $(ALL_RANLIBFLAGS) ", SplitLibFileName, "\n\n"
]),
But that only fixes the second problem.
So here's a fix for both problems.
----------
Estimated hours taken: 1
compiler/modules.m:
In the rule generated for creating the .split.a file,
use `find' and `xargs' to avoid overflowing fixed length
limits on the command line length. This also fixes a
problem where if `ar' fails, we were ignoring the error.
Workspace: /d-drive/home/hg/fjh/mercury
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.108
diff -u -d -r1.108 modules.m
--- compiler/modules.m 1999/09/12 04:26:46 1.108
+++ compiler/modules.m 1999/10/20 04:54:27
@@ -2562,9 +2562,8 @@
SplitLibFileName, " : $(", MakeVarName, ".dir_os) $(MLOBJS)\n",
"\trm -f ", SplitLibFileName, "\n",
"\t$(AR) $(ALL_ARFLAGS) ", SplitLibFileName, " $(MLOBJS)\n",
- "\tfor dir in $(", MakeVarName, ".dirs); do \\\n",
- "\t $(AR) q ", SplitLibFileName, " $$dir/*.o; \\\n",
- "\tdone\n",
+ "\tfind $(", MakeVarName, ".dirs) -name ""*.o"" -print | \\\n",
+ "\t xargs $(AR) q ", SplitLibFileName, "\n",
"\t$(RANLIB) $(ALL_RANLIBFLAGS) ", SplitLibFileName, "\n\n"
]),
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list