Gcc and the need for "make bootstrap"

Greg Schafer gschafer at zip.com.au
Sat Mar 8 15:14:57 PST 2003


Hi

This subject has come up a few times in the past. But it's only now that
I've gotten around to actually analysing and testing it out. This is due to
the fact that we now have a newer more reliable build method that has given
me the opportunity to do so.

Do we really need to "make bootstrap" at every phase of gcc installation?

The answer is no. We only need to do a "make bootstrap" in the very first
phase. After that, it makes no difference, at least according to my testing
so far.

When this idea came up in the past, I was dead against it. In fact, with
current CVS LFS book instructions, it probably won't hold true. Of course,
I'm now using the pure lfs hint stuff as the basis for my work and that is
what I have tested.

This came about coz I'm sick to death of waiting around for test builds to
complete. Having become a bit more familiar with the internals of the gcc
build system lately, I was confident that a "make bootstrap" was not needed
at every phase.

With the current pure lfs hint, we build:-

  Ch 5 - gcc pass 1 - C only
  Ch 5 - gcc pass 2 - C & C++
  Ch 6 - gcc - C & C++

and we "make bootstrap" at each of those steps. But according to my tests we
only need to "make bootstrap" at the first pass. After that a simple "make"
will do the job.

Here is how I tested and proved it. You can do the same to verify if you
wish:-

 - build current pure lfs up to the "Ch 5 - Lock in" stage i.e. ldscripts
   and specs file have been adjusted.

 - skip the tcl, expect & dejagnu pkg's

 - unpack gcc tarball and apply the "no_fixincludes" patch and most
   importantly the "specs" patch. Also apply the "no_debug" patches

 - configure gcc like so (NOTE - I've used "--disable-nls" here):-

CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe" ../gcc-3*/configure \
--prefix=/stage1 --with-local-prefix=/stage1 --enable-languages=c,c++ \
--disable-nls --enable-shared --enable-threads=posix --enable-__cxa_atexit \
--enable-clocale=gnu

 - now make it but DO NOT INSTALL IT like so:-

make LDFLAGS="-s"

 - now install it to a temp' location like so:-

make prefix=/tmp/gcc-test-nobootstrap install

 - cd up one level and rename the gcc-build to something safe just in case
   we need it again.

 - create another gcc-build dir and cd into it and configure exactly like
   the above

 - this time make it by doing:-

make BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 -pipe" STAGE1_CFLAGS="-pipe" \
LDFLAGS="-s" bootstrap

 - again, install it to a (different) temp' location lke so:-

make prefix=/tmp/gcc-test-bootstrap install

 - we now have 1 "bootstrapped" and 1 "non-bootstrapped" gcc installation
   that we can compare using "diff -uNr /tmp/gcc-test-bootstrap
   /tmp/gcc-test-nobootstrap" NOTE - do not use the "-a" diff option!

 - the result of that diff is attached. As you can see, the only differing
   files are the *.a ar archives. ar archives keep the date and time of each
   object file contained within the archive. To compare the actual code, you
   need to manually extract each archive into a temp' dir e.g. "ar x
   /tmp/gcctest.bootstrap/lib/libstdc++.a" then perform a "diff -uNr". The
   results of the extracted code from the 5 *.a files confirm that the
   object files are identical.

So I have therefore proven that the 2 installations are "byte for byte"
identical in terms of the actual code within.

I went even further and did a comparison of the gcc-build dirs in almost
exactly the same fashion as the gcc Makefile when it performs its "bootstrap
comparison". The comments in the Makefile say this:-

"Compare the object files in the current directory with those in the stage2
 directory."

So I took the "stage2" dir from the "bootstrapped" build and copied it
somewhere temp'. Then I copied all the same files from the gcc-build/gcc dir
from the "non-bootstrapped" build to a different temp' dir then did a "diff
-uNr" on the 2 dirs. The resulting diff is attached. As you can see, there
are 4 *.a ar archives and "libgcc.mk" that differ. The *.a ar archives are
identical when extracted. The differences in libgcc.mk are inconsequential
AFAICT. Incidentally, libgcc.mk is not compared during a real gcc bootstrap
comparison.

So there you have it. I want to do some further testing to be 100% sure. If
all goes well, this will be a great time saver.

Greg
-------------- next part --------------
Files gcctest.bootstrap/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libgcc.a and gcctest.nobootstrap/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libgcc.a differ
Files gcctest.bootstrap/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libgcc_eh.a and gcctest.nobootstrap/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/libgcc_eh.a differ
Files gcctest.bootstrap/lib/libiberty.a and gcctest.nobootstrap/lib/libiberty.a differ
Files gcctest.bootstrap/lib/libstdc++.a and gcctest.nobootstrap/lib/libstdc++.a differ
Files gcctest.bootstrap/lib/libsupc++.a and gcctest.nobootstrap/lib/libsupc++.a differ
-------------- next part --------------
Files stage2.bootstrap/libbackend.a and stage2.nobootstrap/libbackend.a differ
Files stage2.bootstrap/libcpp.a and stage2.nobootstrap/libcpp.a differ
Files stage2.bootstrap/libgcc.a and stage2.nobootstrap/libgcc.a differ
diff -uNr stage2.bootstrap/libgcc.mk stage2.nobootstrap/libgcc.mk
--- stage2.bootstrap/libgcc.mk	2003-03-08 23:50:58.000000000 +1100
+++ stage2.nobootstrap/libgcc.mk	2003-03-08 23:11:38.000000000 +1100
@@ -226,7 +226,7 @@
 	else true; fi;
 
 ./libgcc_s.so:  libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o  libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o libgcc/./libgcc.map
-	./xgcc -B./ -B/stage1/i686-pc-linux-gnu/bin/ -isystem /stage1/i686-pc-linux-gnu/include -isystem /stage1/i686-pc-linux-gnu/sys-include -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC  -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/./libgcc.map -o libgcc_s.so.1   libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o  libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o -lc && rm -f libgcc_s.so && ln -s libgcc_s.so.1 libgcc_s.so
+	/mnt/hdb6/home/gws/scratch/gcc-build/gcc/xgcc -B/mnt/hdb6/home/gws/scratch/gcc-build/gcc/ -B/stage1/i686-pc-linux-gnu/bin/ -B/stage1/i686-pc-linux-gnu/lib/ -isystem /stage1/i686-pc-linux-gnu/include -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC  -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/./libgcc.map -o libgcc_s.so.1   libgcc/./_muldi3.o libgcc/./_negdi2.o libgcc/./_lshrdi3.o libgcc/./_ashldi3.o libgcc/./_ashrdi3.o libgcc/./_ffsdi2.o libgcc/./_clz.o libgcc/./_cmpdi2.o libgcc/./_ucmpdi2.o libgcc/./_floatdidf.o libgcc/./_floatdisf.o libgcc/./_fixunsdfsi.o libgcc/./_fixunssfsi.o libgcc/./_fixunsdfdi.o libgcc/./_fixdfdi.o libgcc/./_fixunssfdi.o libgcc/./_fixsfdi.o libgcc/./_fixxfdi.o libgcc/./_fixunsxfdi.o libgcc/./_floatdixf.o libgcc/./_fixunsxfsi.o libgcc/./_fixtfdi.o libgcc/./_fixunstfdi.o libgcc/./_floatditf.o libgcc/./_clear_cache.o libgcc/./_trampoline.o libgcc/./__main.o libgcc/./_exit.o libgcc/./_absvsi2.o libgcc/./_absvdi2.o libgcc/./_addvsi3.o libgcc/./_addvdi3.o libgcc/./_subvsi3.o libgcc/./_subvdi3.o libgcc/./_mulvsi3.o libgcc/./_mulvdi3.o libgcc/./_negvsi2.o libgcc/./_negvdi2.o libgcc/./_ctors.o libgcc/./_divdi3.o libgcc/./_moddi3.o libgcc/./_udivdi3.o libgcc/./_umoddi3.o libgcc/./_udiv_w_sdiv.o libgcc/./_udivmoddi4.o  libgcc/./unwind-dw2.o libgcc/./unwind-dw2-fde-glibc.o libgcc/./unwind-sjlj.o -lc && rm -f libgcc_s.so && ln -s libgcc_s.so.1 libgcc_s.so
 
 libgcc-stage-start:
 	for dir in libgcc; do \
@@ -249,4 +249,4 @@
 	$(RANLIB_FOR_TARGET) $(DESTDIR)$(libsubdir)/libgcc.a
 	$(INSTALL_DATA) ./libgcc_eh.a $(DESTDIR)$(libsubdir)/
 	$(RANLIB_FOR_TARGET) $(DESTDIR)$(libsubdir)/libgcc_eh.a
-	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(slibdir); /usr/bin/install -c -m 644 libgcc_s.so.1 $(DESTDIR)$(slibdir)/libgcc_s.so.1; rm -f $(DESTDIR)$(slibdir)/libgcc_s.so; ln -s libgcc_s.so.1 $(DESTDIR)$(slibdir)/libgcc_s.so
+	$(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(slibdir); /bin/sh /mnt/hdb6/home/gws/scratch/gcc-3.2.2/install-sh -c -m 644 libgcc_s.so.1 $(DESTDIR)$(slibdir)/libgcc_s.so.1; rm -f $(DESTDIR)$(slibdir)/libgcc_s.so; ln -s libgcc_s.so.1 $(DESTDIR)$(slibdir)/libgcc_s.so
Files stage2.bootstrap/libgcc_eh.a and stage2.nobootstrap/libgcc_eh.a differ


More information about the lfs-dev mailing list