From 1a3e6a31a791143c3075dab21a5d47a0f344cce5 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Wed, 25 Apr 2012 19:26:21 +0000 Subject: Merge changes developed and tested in the jh branch git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9831 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter05/gcc-pass2.xml | 70 ++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 50 deletions(-) (limited to 'chapter05/gcc-pass2.xml') diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml index e2f3cd09c..0ed5c11aa 100644 --- a/chapter05/gcc-pass2.xml +++ b/chapter05/gcc-pass2.xml @@ -43,15 +43,20 @@ Installation of GCC - Versions of GCC later than 4.3 will treat this build as if - it were a relocated compiler and disallow searching for startfiles in - the location specified by --prefix. Since this - will not be a relocated compiler, and the startfiles in - /tools are crucial to building - a working compiler linked to the libs in /tools, - apply the following patch which partially reverts GCC to its old behavior: - -patch -Np1 -i ../&gcc-startfiles-patch; + Our first build of GCC has installed a couple of internal system + headers. Normally one of them, limits.h will in turn + include the corresponding system limits.h header, in + this case, /tools/include/limits.h. However, at the + time of the first build of gcc /tools/include/limits.h + did not exist, so the internal header that GCC installed is a partial, + self-contained file and does not include the extended features of the + system header. This was adequate for building the temporary libc, but this + build of GCC now requires the full internal header. Create a full version + of the internal header using a command that is identical to what the GCC + build system does in normal circumstances: + +cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ + `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h Under normal circumstances the GCC fixincludes script is run in order to fix potentially broken header files. As GCC-&gcc-version; @@ -76,14 +81,9 @@ sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in - The following command will change the location of GCC's default - dynamic linker to use the one installed in - /tools. It also removes /usr/include from GCC's include search path. - Doing this now rather than adjusting the specs file after installation - ensures that the new dynamic linker is used during the actual build of - GCC. That is, all of the binaries created during the build will link - against the new Glibc. Issue: + Once again, change the location of GCC's default dynamic linker to + use the one installed in /tools. for file in \ $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h) @@ -94,40 +94,11 @@ do echo ' #undef STANDARD_STARTFILE_PREFIX_1 #undef STANDARD_STARTFILE_PREFIX_2 -#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib" +#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file touch $file.orig done - In case the above seems hard to follow, let's break it down a bit. - First we find all the files under the - gcc/config directory that are named - either linux.h, linux64.h or - sysv4.h. - For each file found, we copy it to a file of the same name but with an added - suffix of .orig. Then the first sed expression prepends - /tools to every instance of /lib/ld, - /lib64/ld or /lib32/ld, while the second one - replaces hard-coded instances of /usr. Then we add our define - statements which alter the include search path and the default startfile prefix - to the end of the file. - Finally, we use touch to update the timestamp on the copied files. - When used in conjunction with cp -u, this prevents unexpected - changes to the original files in case the commands are inadvertently run twice. - - - On x86_64, unsetting the multilib spec for GCC ensures that it - won't attempt to link against libraries on the host: - -case $(uname -m) in - x86_64) - for file in $(find gcc/config -name t-linux64) ; do \ - cp -v $file{,.orig} - sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file - done - ;; -esac - As in the first build of GCC it requires the GMP, MPFR and MPC packages. Unpack the tarballs and move them into the required directory names: @@ -149,12 +120,13 @@ cd ../gcc-build Now prepare GCC for compilation: -CC="$LFS_TGT-gcc -B/tools/lib/" \ +CC="$LFS_TGT-gcc" \ AR=$LFS_TGT-ar \ RANLIB=$LFS_TGT-ranlib \ ../gcc-&gcc-version;/configure \ --prefix=/tools \ --with-local-prefix=/tools \ + --with-native-system-header-dir=/tools/include \ --enable-clocale=gnu \ --enable-shared \ --enable-threads=posix \ @@ -164,8 +136,6 @@ RANLIB=$LFS_TGT-ranlib \ --disable-multilib \ --disable-bootstrap \ --disable-libgomp \ - --without-ppl \ - --without-cloog \ --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \ --with-mpfr-lib=$(pwd)/mpfr/src/.libs -- cgit v1.2.3-54-g00ecf