xgcc: installation problem, cannot exec `../stage1/collect2': Arg list too long

Zack Weinberg zack@wolery.cumb.org
Sun Jun 18 15:02:00 GMT 2000


On Sat, Jun 17, 2000 at 02:03:55PM -0400, John David Anglin wrote:
> xgcc: installation problem, cannot exec `../stage1/collect2':
>       Arg list too long
> 
> Any thoughts in getting around this one?  This looks like a system limit.
> Maybe we need a library of gcc objects?

Putting the back end in a library seems like a good idea to me,
never mind whether or not we're really hitting command line length limits.
Here's a patch - has been bootstrapped on i386-linux, testsuite is running
now.  Please let us know if it solves your problem.

Note this inflicts ordering constraints on cc1* link lines; $(BACKEND)
has to come after the front end objects.  Also, toplev.o has to be
left out of the library since it contains main.

It occurred to me, while generating this patch, that we could easily
have nonrecursive builds within the gcc directory by moving all the logic
from subdirs' Makefile.in to their Make-lang.in.  The objc directory is
already like that.  I bet the build system would get significantly simpler.
I may try to do this in a successor patch.

zw


	* Makefile.in: Remove toplev.o from OBJS.  Add rule to make
	libbackend.a; add libbackend.a to STAGESTUFF.  Add BACKEND
	variable.  Use BACKEND when linking cc1, not OBJS.  Add BACKEND
	to VOL_FILES.
ch:
	* Make-lang.in (cc1chill): Depend on $(BACKEND), not stamp-objlist.
	* Makefile.in (cc1chill): Link with $(BACKEND).  Define BACKEND,
	eliminate C_OBJS (was commented out), OBJS, OBJDEPS.
cp:
	* Make-lang.in (cc1plus): Depend on $(BACKEND), not stamp-objlist.
	* Makefile.in: Add C_OBJS, BACKEND; delete OBJS, OBJDEPS.
	(cc1plus): Link with $(BACKEND) and $(C_OBJS).
f:
	* Make-lang.in (f771): Depend on $(BACKEND), not stamp-objlist.
	* Makefile.in: Add BACKEND; delete OBJS, OBJDEPS.
	(f771): Link with $(BACKEND).
java:
	* Make-lang.in (jc1, jv-scan): Depend on $(BACKEND), not stamp-objlist.
	* Makefile.in: Add BACKEND; delete OBJS, OBJDEPS.
	(jc1): Link with $(BACKEND).
	(jv-scan): Depend on version.o, not all of $(OBJS) or $(BACKEND).
objc:
	* Make-lang.in (cc1obj): Link with $(BACKEND).
===================================================================
Index: Makefile.in
--- Makefile.in	2000/06/13 20:06:39	1.466
+++ Makefile.in	2000/06/18 21:48:05
@@ -682,8 +682,8 @@ C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-d
 C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
 
 # Language-independent object files.
-OBJS = diagnostic.o							      \
- toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o	      \
+
+OBJS = diagnostic.o version.o tree.o print-tree.o stor-layout.o fold-const.o  \
  function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o real.o  \
  builtins.o intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o   \
  dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o  \
@@ -696,6 +696,8 @@ OBJS = diagnostic.o							      \
  lists.o ggc-common.o $(GGC) simplify-rtx.o ssa.o bb-reorder.o		      \
  sibcall.o conflict.o timevar.o ifcvt.o
 
+BACKEND = toplev.o libbackend.a
+
 # GEN files are listed separately, so they can be built before doing parallel
 #  makes for cc1 or cc1plus.  Otherwise sequent parallel make attempts to load
 #  them before rtl.o is compiled.
@@ -718,7 +720,7 @@ STAGESTUFF = *$(objext) insn-flags.h ins
  $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) cc1obj$(exeext) \
  enquire$(exeext) protoize$(exeext) unprotoize$(exeext) \
  specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
- gcov$(exeext) *.[0-9][0-9].* *.[si] libcpp.a libgcc libgcc.mk \
+ gcov$(exeext) *.[0-9][0-9].* *.[si] libcpp.a libbackend.a libgcc libgcc.mk \
  $(LANG_STAGESTUFF)
 
 # Members of libgcc1.a.
@@ -891,12 +893,13 @@ libgcc1-test.o: libgcc1-test.c native xg
 
 # Recompile all the language-independent object files.
 # This is used only if the user explicitly asks for it.
-compilations: ${OBJS}
+compilations: $(BACKEND)
 
-# Create a list of the language-independent object files so the language
-# subdirectories needn't mention their names explicitly.
-stamp-objlist: $(OBJS)
-	echo " $(OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
+# Like libcpp.a, this archive is strictly for the host.
+libbackend.a: $(OBJS)
+	-rm -rf libbackend.a
+	$(AR) $(AR_FLAGS) libbackend.a $(OBJS)
+	if $(RANLIB_TEST) ; then $(RANLIB) libbackend.a ; else true ; fi
 
 # We call this executable `xgcc' rather than `gcc'
 # to avoid confusion if the current directory is in the path
@@ -927,8 +930,9 @@ specs: xgcc$(exeext)
 gcc-cross: xgcc$(exeext)
 	cp xgcc$(exeext) gcc-cross$(exeext)
 
-cc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS)
+cc1$(exeext): $(P) $(C_OBJS) $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1$(exeext) \
+		$(C_OBJS) $(BACKEND) $(LIBS)
 
 # Build the version of limits.h that we will install.
 xlimits.h: glimits.h limitx.h limity.h
@@ -1780,9 +1784,8 @@ LIBCPP_OBJS =	cpplib.o cpphash.o cpperro
 
 LIBCPP_DEPS =	cpplib.h cpphash.h intl.h system.h
 
-# All the other archives built/used by this makefile are for targets.  This
-# one is strictly for the host.
-#
+# Most of the other archives built/used by this makefile are for
+# targets.  This one is strictly for the host.
 libcpp.a: $(LIBCPP_OBJS)
 	-rm -rf libcpp.a
 	$(AR) $(AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
@@ -2720,7 +2723,7 @@ diff:
 	  gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
 
 # A list of files to be destroyed during "lean" builds.
-VOL_FILES=`echo $(OBJS) $(C_OBJS) $(LIBCPP_OBJS) *.c *.h gen*`
+VOL_FILES=`echo $(BACKEND) $(OBJS) $(C_OBJS) $(LIBCPP_OBJS) *.c *.h gen*`
 
 bootstrap bootstrap-lean: force
 # Only build the C compiler for stage1, because that is the only one that
===================================================================
Index: ch/Make-lang.in
--- ch/Make-lang.in	2000/06/13 21:31:26	1.14
+++ ch/Make-lang.in	2000/06/18 21:48:08
@@ -93,7 +93,7 @@ chill: $(srcdir)/ch/chill.in Makefile
 chill-cross: $(srcdir)/ch/chill.in
 	touch $@
 
-cc1chill$(exeext): $(P) $(CHILL_SRCS) $(LIBDEPS) stamp-objlist \
+cc1chill$(exeext): $(P) $(CHILL_SRCS) $(LIBDEPS) $(BACKEND) \
 	insn-config.h insn-flags.h insn-attr.h insn-codes.h \
 	c-typeck.o c-aux-info.o c-common.o c-iterate.o \
         ggc-callbacks.o
===================================================================
Index: ch/Makefile.in
--- ch/Makefile.in	2000/06/11 04:29:47	1.25
+++ ch/Makefile.in	2000/06/18 21:48:08
@@ -193,20 +193,16 @@ FLAGS_TO_PASS = \
 
 # Language-specific object files for CHILL
 
-#C_OBJS = ../cpplib.o ../cppexp.o ../cpphash.o ../cpperror.o
-
 CHILL_OBJS = parse.o actions.o except.o grant.o lang.o \
    tree.o lex.o decl.o typeck.o convert.o expr.o loop.o \
    tasking.o timing.o inout.o satisfy.o ch-version.o \
    ../ggc-callbacks.o
 
-# Language-independent object files.
-OBJS = `cat ../stamp-objlist`
-OBJDEPS = ../stamp-objlist
+BACKEND = ../toplev.o ../libbackend.a
 
-../cc1chill$(exeext): $(P) $(CHILL_OBJS) $(OBJDEPS) $(LIBDEPS)
+../cc1chill$(exeext): $(P) $(CHILL_OBJS) $(BACKEND) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(CHILL_OBJS) \
-	      $(OBJS) $(C_OBJS) $(LIBS)
+	      $(BACKEND) $(LIBS)
 
 # This executable is used in the CHILL regression 
 # test script
===================================================================
Index: cp/Make-lang.in
--- cp/Make-lang.in	2000/06/14 17:26:18	1.55
+++ cp/Make-lang.in	2000/06/18 21:48:08
@@ -122,7 +122,7 @@ CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)
  $(srcdir)/cp/semantics.c $(srcdir)/cp/spew.c $(srcdir)/cp/tree.c \
  $(srcdir)/cp/typeck.c $(srcdir)/cp/typeck2.c $(srcdir)/cp/xref.c
 
-cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o \
+cc1plus$(exeext): $(P) $(CXX_SRCS) $(LIBDEPS) $(BACKEND) c-common.o \
         c-pragma.o $(srcdir)/cp/cp-tree.h $(srcdir)/cp/cp-tree.def \
 	$(srcdir)/c-common.def $(srcdir)/cp/gxx.gperf $(srcdir)/cp/cfns.gperf hash.o \
 	$(srcdir)/cp/operators.def
===================================================================
Index: cp/Makefile.in
--- cp/Makefile.in	2000/06/15 21:24:38	1.90
+++ cp/Makefile.in	2000/06/18 21:48:09
@@ -173,18 +173,21 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcd
 
 # Language-specific object files for g++
 
+# Shared with C front end:
+C_OBJS = ../c-common.o ../c-pragma.o
+
 CXX_OBJS = call.o decl.o errfn.o expr.o pt.o typeck2.o \
  class.o decl2.o error.o lex.o parse.o ptree.o rtti.o spew.o typeck.o cvt.o \
  except.o friend.o init.o method.o search.o semantics.o tree.o xref.o \
  repo.o dump.o optimize.o mangle.o @extra_cxx_objs@
 
 # Language-independent object files.
-OBJS = `cat ../stamp-objlist` ../c-common.o ../c-pragma.o
-OBJDEPS = ../stamp-objlist ../c-common.o ../c-pragma.o
+BACKEND = ../toplev.o ../libbackend.a
 
 compiler: ../cc1plus$(exeext)
-../cc1plus$(exeext): $(P) $(OBJDEPS) $(CXX_OBJS) $(LIBDEPS)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(CXX_OBJS) $(LIBS)
+../cc1plus$(exeext): $(P) $(CXX_OBJS) $(C_OBJS) $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+	      $(CXX_OBJS) $(C_OBJS) $(BACKEND) $(LIBS)
 
 Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
 	cd ..; $(SHELL) config.status
===================================================================
Index: f/Make-lang.in
--- f/Make-lang.in	2000/06/17 13:53:59	1.64
+++ f/Make-lang.in	2000/06/18 21:48:09
@@ -200,7 +200,7 @@ F77_SRCS = \
  $(srcdir)/f/where.c \
  $(srcdir)/f/where.h
 
-f771$(exeext): $(P) $(F77_SRCS) $(LIBDEPS) stamp-objlist
+f771$(exeext): $(P) $(F77_SRCS) $(LIBDEPS) $(BACKEND)
 	touch lang-f77
 	cd f; $(MAKE) $(LANG_FLAGS_TO_PASS) \
 	  HOST_CC="`case '$(HOST_CC)' in stage*) echo '$(HOST_CC)' | sed -e 's|stage|../stage|g';; *) echo '$(HOST_CC)';; esac`" \
===================================================================
Index: f/Makefile.in
--- f/Makefile.in	2000/06/06 07:23:41	1.22
+++ f/Makefile.in	2000/06/18 21:48:09
@@ -200,13 +200,12 @@ F77_OBJS = \
  where.o
 
 # Language-independent object files.
-OBJS = `cat ../stamp-objlist`
-OBJDEPS = ../stamp-objlist
+BACKEND = ../toplev.o ../libbackend.a
 
 compiler: ../f771$(exeext)
-../f771$(exeext): $(P) $(F77_OBJS) $(OBJDEPS) $(LIBDEPS)
+../f771$(exeext): $(P) $(F77_OBJS) $(BACKEND) $(LIBDEPS)
 	rm -f f771$(exeext)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(F77_OBJS) $(OBJS) $(LIBS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(F77_OBJS) $(BACKEND) $(LIBS)
 
 Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
 	cd ..; $(SHELL) config.status
===================================================================
Index: java/Make-lang.in
--- java/Make-lang.in	2000/06/06 07:23:42	1.31
+++ java/Make-lang.in	2000/06/18 21:48:09
@@ -77,7 +77,7 @@ JAVA_SRCS = $(srcdir)/java/parse.y $(src
   $(srcdir)/java/check-init.c $(srcdir)/java/lex.c $(srcdir)/java/boehm.c \
   $(srcdir)/java/jcf-depend.c  $(srcdir)/java/jcf-path.c
 
-jc1$(exeext): $(P) $(JAVA_SRCS) $(LIBDEPS) stamp-objlist ggc-callbacks.o
+jc1$(exeext): $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) ggc-callbacks.o
 	cd java; $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jc1$(exeext)
 
 jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H)
@@ -116,7 +116,7 @@ $(INTL_TARGETS): $(srcdir)/java/parse.c 
 JV_SCAN_SOURCES = $(srcdir)/java/parse-scan.y $(srcdir)/java/lex.c \
        $(srcdir)/java/parse.h $(srcdir)/java/lex.h $(srcdir)/java/jv-scan.c
 
-jv-scan$(exeext): $(JV_SCAN_SOURCES) stamp-objlist $(LIBDEPS)
+jv-scan$(exeext): $(JV_SCAN_SOURCES) $(BACKEND) $(LIBDEPS)
 	cd java && $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jv-scan$(exeext)
 
 # This must be kept in sync with dependencies in Makefile.in.
===================================================================
Index: java/Makefile.in
--- java/Makefile.in	2000/06/06 07:23:42	1.51
+++ java/Makefile.in	2000/06/18 21:48:09
@@ -177,14 +177,13 @@ JAVA_OBJS = parse.o class.o decl.o expr.
 JAVA_OBJS_LITE = parse-scan.o jv-scan.o
 
 # Language-independent object files.
-OBJS = `cat ../stamp-objlist` ../ggc-callbacks.o
-OBJDEPS = ../stamp-objlist ../ggc-callbacks.o
+BACKEND = ../toplev.o ../ggc-callbacks.o ../libbackend.a
 
 compiler: ../jc1$(exeext) ../jv-scan$(exeext)
-../jc1$(exeext): $(P) $(JAVA_OBJS) $(OBJDEPS) $(LIBDEPS)
+../jc1$(exeext): $(P) $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
 	rm -f ../jc1$(exeext)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JAVA_OBJS) $(OBJS) $(LIBS)
-../jv-scan$(exeext): $(P) $(JAVA_OBJS_LITE) $(OBJDEPS) ../version.o $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JAVA_OBJS) $(BACKEND) $(LIBS)
+../jv-scan$(exeext): $(P) $(JAVA_OBJS_LITE) ../version.o $(LIBDEPS)
 	rm -f ../jv-scan$(exeext)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JAVA_OBJS_LITE) ../version.o $(LIBS)
 
===================================================================
Index: objc/Make-lang.in
--- objc/Make-lang.in	2000/05/03 22:45:31	1.25
+++ objc/Make-lang.in	2000/06/18 21:48:13
@@ -59,8 +59,8 @@ OBJECTIVE-C objective-c: cc1obj$(exeext)
 # Language-specific object files for Objective C.
 OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS)
 
-cc1obj$(exeext): $(P) $(OBJS) $(OBJC_OBJS) $(LIBDEPS)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(OBJC_OBJS) $(LIBS)
+cc1obj$(exeext): $(P) $(OBJC_OBJS) $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(BACKEND) $(LIBS)
 
 # Objective C language specific files.
 


More information about the Gcc-bugs mailing list