Author: robert Date: 2010-02-16 20:42:28 -0700 (Tue, 16 Feb 2010) New Revision: 1537
Modified: branches/Onward/changes.txt branches/Onward/downloads/packages.txt branches/Onward/downloads/patches.txt branches/Onward/temporary_system/binutils_pass2.txt branches/Onward/temporary_system/gcc_pass1.txt branches/Onward/temporary_system/gcc_pass2.txt branches/Onward/things_we_do.txt Log: Bump to gcc-4.4. Added GMP and MPFR. Added native non-multilib x86_64 support to instructions and patches. Modified: branches/Onward/changes.txt =================================================================== --- branches/Onward/changes.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/changes.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -5,9 +5,8 @@ # installed to /tools, with --infodir=$(pwd)/DESTDIR --mandir=$(pwd)/DESTDIR, # or with whatever works. -# Build for i486-pc-linux-gnu, for stability. Use something else if you want, -# and CFLAGS optimizations if you want, but if you do then don't report test -# suite failures or segmentation faults to hlfs. +# Support native x86_32 and x86_64. No multilib, cross compiling, or emulation. +# Contact the mailing list if you want to help add support for more platforms. # Added several small changes to the tools required to boot the temporary # system. These changes were made to e2fsprogs, sysvinit, udev, and Modified: branches/Onward/downloads/packages.txt =================================================================== --- branches/Onward/downloads/packages.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/downloads/packages.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -45,7 +45,7 @@ http://ftp.gnu.org/gnu/gawk/gawk-3.1.6.tar.bz2 # GCC-4.2 snapshot: -ftp://gcc.gnu.org/pub/gcc/snapshots/LATEST-4.2/ +ftp://gcc.gnu.org/pub/gcc/snapshots/LATEST-4.4/ # Gettext: # http://ftp.gnu.org/gnu/gettext/gettext-0.17.tar.gz.sig @@ -55,6 +55,10 @@ # You may want to follow this symlink, and get the real file name. ftp://sources.redhat.com/pub/glibc/snapshots/glibc-2.9-latest.tar.bz2 +# GMP: +# http://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.bz2.sig +http://ftp.gnu.org/gnu/gmp/gmp-5.0.1.tar.bz2 + # Grep: # http://ftp.gnu.org/gnu/grep/grep-2.5.4.tar.bz2.sig http://ftp.gnu.org/gnu/grep/grep-2.5.4.tar.bz2 @@ -83,6 +87,10 @@ # http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-3.6.tar.bz2.sign http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-3.6.tar.bz2 +# MPFR: +# http://www.mpfr.org/mpfr-current/mpfr-2.4.2.tar.bz2.asc +http://www.mpfr.org/mpfr-current/mpfr-2.4.2.tar.bz2 + # Ncurses: # ftp://invisible-island.net/ncurses/ncurses-5.7.tar.gz.asc ftp://invisible-island.net/ncurses/ncurses-5.7.tar.gz Modified: branches/Onward/downloads/patches.txt =================================================================== --- branches/Onward/downloads/patches.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/downloads/patches.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -20,17 +20,14 @@ http://www.linuxfromscratch.org/patches/downloads/expect/expect-5.43.0-tcl_8.5.4_fix-1.patch # GCC -fPIE patch: -http://www.linuxfromscratch.org/~robert/new/patches/gcc-4.2-20081001-fpie-2.diff +http://www.linuxfromscratch.org/~robert/new/patches/gcc-4.4-fpie.diff # GCC -D_FORTIFY_SOURCE=2 patch: -http://www.linuxfromscratch.org/patches/downloads/gcc/gcc-4.1.2-fortify_source-2.patch +http://www.linuxfromscratch.org/~robert/new/patches/gcc-4.4-fortify_source.diff # GCC -fstack-protector-all patch: -http://www.linuxfromscratch.org/~robert/new/patches/gcc-4.2-20081001-fstack_protector.diff +http://www.linuxfromscratch.org/~robert/new/patches/gcc-4.4-fstack_protector.diff -# GCC's libiberty fix for -D_FORTIFY_SOURCE: -http://www.linuxfromscratch.org/~robert/new/patches/gcc-4.2-20081001-asprintf_fix.diff - # Gettext upstream fixes: http://www.linuxfromscratch.org/~robert/new/patches/gettext-0.17-upstream_fixes-2.diff @@ -93,6 +90,10 @@ # Module-init-tools man pages patch: http://www.linuxfromscratch.org/patches/downloads/module-init-tools/module-init-tools-3.6-man_pages-1.patch +# MPFR branch update patch: +# wget --output-document=mpfr-2.4.2-branch_update.diff http://www.mpfr.org/mpfr-current/allpatches +http://www.mpfr.org/mpfr-current/allpatches + # Perl upstream fixes patch: http://www.linuxfromscratch.org/patches/downloads/perl/perl-5.10.0-consolidated-1.patch Modified: branches/Onward/temporary_system/binutils_pass2.txt =================================================================== --- branches/Onward/temporary_system/binutils_pass2.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/temporary_system/binutils_pass2.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -2,10 +2,6 @@ patch -p1 -i ../binutils-2.19-pt-pax-flags-200811041810.patch && -# Binutils libiberty has the same _FORTIFY_SOURCE bug GCC has: - -patch -p0 -i ../gcc-4.2-20081001-asprintf_fix.diff && - # Configure, build, and install Binutils: mkdir -v obj/ && Modified: branches/Onward/temporary_system/gcc_pass1.txt =================================================================== --- branches/Onward/temporary_system/gcc_pass1.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/temporary_system/gcc_pass1.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -1,38 +1,75 @@ # Temporary tools - GCC Pass 1 -# We could use the fpie patch here, but if our host system is older than -# glibc-2.3.3 it wouldn't work. So we just use -fPIC: +# The GMP and MPFR packages are required for this version of GCC. At this stage +# it is easiest to build them inside the GCC source tree: +tar -jxf ../gmp-5.0.1.tar.bz2 && +ln -vs gmp-5.0.1 gmp && +tar -jxf ../mpfr-2.4.2.tar.bz2 && +ln -vs mpfr-2.4.2 mpfr && + +# Patch MPFR with upstream fixes: + +cd mpfr-2.4.2/ && +patch -p1 -i ../../mpfr-2.4.2-branch_update.diff && +cd ../ && + +# Modify GCC to make -fPIC the default. This is needed to make Glibc aware we +# have a PIC compiler. The other GCC hardening options depend on the host +# system C library, and are not necessary at this stage: + cp -v gcc/config/i386/linux.h{,.orig} && sed 's/^\(#define CC1_SPEC.*\)\("\)$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \ gcc/config/i386/linux.h.orig > gcc/config/i386/linux.h && +cp -v gcc/config/i386/x86-64.h{,.orig} && +sed 's/^\(#define CC1_SPEC.*\)\("\)$/\1 %{fno-pic|fpic|fPIC:;:-fPIC}\2/' \ + gcc/config/i386/x86-64.h.orig > gcc/config/i386/x86-64.h && -# GCC wants us to add to the version string if we do modifications to GCC: +# GCC wants us to modify the version string if we do modifications to GCC: cp -v gcc/version.c{,.orig} && sed 's/#define VERSUFFIX ""/#define VERSUFFIX " PIC"/' \ gcc/version.c.orig > gcc/version.c && -# libssp has no use with new versions of Glibc. Glibc completely replaces all -# functions in libssp, linking to libssp will cause conflicts with libc, so -# libssp is a waste of space... so --disable-libssp. +# On a pure64 CLFS host system we will not have a /lib64 directory, but GCC +# will expect to link there, so we fix that: -# --libexecdir is added for consistency with the final system. +cp -v gcc/config/i386/linux64.h{,.orig} && +sed 's@/lib64/@/lib/@' gcc/config/i386/linux64.h.orig \ + > gcc/config/i386/linux64.h && -# --with-cpu=i486 and --with-arch=i486 set -mtune=i486 and -march=i486. This -# is mainly for Glibc, but in general it will produce more stable code (at the -# cost of performance). This is a workaround for unexpected bugs in Glibc, -# GCC, and other packages. +# On an x86_64 GCC assumes the system is multilib and installs libgcc_s.so to +# "${prefix}/../lib64". The following command disables this so we only install +# to /tools/lib: +cp -v gcc/config/i386/t-linux64{,.orig} && +sed '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64.orig \ + > gcc/config/i386/t-linux64 && + +# Configure GCC: + mkdir -v obj/ && cd obj/ && -../configure --prefix=/tools \ - --with-local-prefix=/tools --disable-nls --enable-shared \ - --enable-languages=c --libexecdir=/tools/lib --disable-libssp \ - --target=i486-pc-linux-gnu --host=i486-pc-linux-gnu \ - --build=i486-pc-linux-gnu --with-cpu=i486 --with-arch=i486 \ +../configure --prefix=/tools --with-local-prefix=/tools \ + --libexecdir=/tools/lib --enable-shared --enable-languages=c \ + --disable-nls --disable-multilib --disable-libssp --disable-libgomp \ + --disable-libmudflap --disable-decimal-float \ + --without-cloog --without-ppl \ --infodir=$(pwd)/DESTDIR --mandir=$(pwd)/DESTDIR && +# --disable-libssp prevents GCC from building the independent SSP library. +# Everything in this library is included in Glibc, and so we do not need it. + +# --disable-libgomp --disable-libmudflap --disable-decimal-float disable the +# building of unneeded libraries. At this stage we only need a GCC to build +# Glibc, and Glibc does not use these libraries. + +# FIXME: Add Cloog and PPL +# --without-cloog --without-ppl disable support for Cloog and PPL if they're +# found on the host system. This is for Graphite optimizations. + +# Build and install GCC: + make && make install && ln -vs gcc /tools/bin/cc Modified: branches/Onward/temporary_system/gcc_pass2.txt =================================================================== --- branches/Onward/temporary_system/gcc_pass2.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/temporary_system/gcc_pass2.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -1,62 +1,87 @@ # Temporary tools - GCC Pass 2 -# Modify the source so the fix includes script does not get used: +# Unpack GMP and MPFR: +tar -jxf ../gmp-5.0.1.tar.bz2 && +ln -vs gmp-5.0.1 gmp && +tar -jxf ../mpfr-2.4.2.tar.bz2 && +ln -vs mpfr-2.4.2 mpfr && + +# Patch MPFR with upstream fixes: + +cd mpfr-2.4.2/ && +patch -p1 -i ../../mpfr-2.4.2-branch_update.diff && +cd ../ && + +# Modify the source so the unwanted fixincludes script does not get used: + cp -v gcc/Makefile.in{,.orig} && sed 's...@\./fixinc\...@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in && -# Modify the source so /tools/lib is used for linking: +# Modify the source so /tools/lib/ and /tools/include/ are used instead of the +# directories on the host system: -for file in $(find gcc/config -name linux64.h -o -name linux.h) +for file in $(find gcc/config/i386 -name linux64.h -o -name linux.h) do - cp -v $file{,.orig} - sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ - -e 's@/usr@/to...@g' $file.orig > $file - echo " -#undef STANDARD_INCLUDE_DIR -#define STANDARD_INCLUDE_DIR 0" >> $file - touch $file.orig + cp -v $file{,.orig} && + sed -e 's@/lib/@/tools/lib/@' -e 's@/lib64/@/tools/lib/@' $file.orig \ + > $file done && +echo ' +#undef STANDARD_INCLUDE_DIR +#define STANDARD_INCLUDE_DIR "/tools/include/" +#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" +#define STANDARD_STARTFILE_PREFIX_2 "" +' >> gcc/config/linux.h && + +# Disable the multilib directories for x86_64: + +cp -v gcc/config/i386/t-linux64{,.orig} && +sed '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64.orig \ + > gcc/config/i386/t-linux64 && + # Libgomp uses -Werror regardless of --disable-werror, and this will cause a # build failure when -D_FORTIFY_SOURCE=2 causes build time warnings: cp -v libgomp/configure{,.orig} && -sed 's/-Werror//' libgomp/configure.orig > libgomp/configure +sed 's/-Werror//' libgomp/configure.orig > libgomp/configure && -# Enable hardening by default: +# Patch to add -D_FORTIFY_SOURCE=2: -patch -p1 -i ../gcc-4.1.2-fortify_source-2.patch && -patch -p1 -i ../gcc-4.2-20081001-fstack_protector.diff && +patch -p1 -i ../gcc-4.4-fortify_source.diff && -# This fpie patch also warns about DT_TEXTREL in shared objects (libraries and -# PIE's), and makes linker warnings fatal. Disable --fatal-warnings with -# -Wl,--no-fatal-warnings. +# Patch to add -fstack-protector-all: -patch -p1 -i ../gcc-4.2-20081001-fpie-2.diff && +patch -p1 -i ../gcc-4.4-fstack_protector.diff && -# This patch fixes a conflict between libiberty's asprintf() and Glibc's, when -# -D_FORTIFY_SOURCE=2 is used: +# Patch to add -fPIE -Wl,-pie -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel +# -Wl,--fatal-warnings. These options can be disabled with -fno-PIE, -nopie, +# -norelro, -nonow, -Wl,--no-fatal-warnings. --warn-shared-textrel can not be +# disabled. --no-fatal-warnings will cause errors if a text relocation is found +# in a shared object, and if mktemp(3) or tmpnam(3) are used. Apply this patch: -patch -p0 -i ../gcc-4.2-20081001-asprintf_fix.diff && +patch -p1 -i ../gcc-4.4-fpie.diff && # Add to the GCC version string: cp -v gcc/version.c{,.orig} && -sed 's/#define VERSUFFIX ""/#define VERSUFFIX " PIE SSP FORTIFY_SOURCE"/' \ +sed 's/#define VERSUFFIX ""/#define VERSUFFIX " FORTIFY_SOURCE SSP PIE"/' \ gcc/version.c.orig > gcc/version.c && # We need to do another bootstrap, so that everything in /tools is hardened. mkdir -v obj && cd obj/ && +env gcc_cv_libc_provides_ssp=yes \ ../configure --prefix=/tools --with-local-prefix=/tools \ - --enable-clocale=gnu --enable-shared --enable-threads=posix \ - --enable-__cxa_atexit --enable-languages=c,c++ --disable-libssp \ - --disable-libstdcxx-pch --disable-werror --libexecdir=/tools/lib \ - --target=i486-pc-linux-gnu --host=i486-pc-linux-gnu \ - --build=i486-pc-linux-gnu --with-cpu=i486 --with-arch=i486 \ - --infodir=$(pwd)/DESTDIR --mandir=$(pwd)/DESTDIR && + --libexecdir=/tools/lib --enable-clocale=gnu \ + --enable-shared --enable-threads=posix \ + --enable-__cxa_atexit --enable-languages=c,c++ \ + --disable-libssp --disable-libstdcxx-pch \ + --disable-multilib --disable-werror \ + --without-cloog --without-ppl \ + --infodir=$(pwd)/DESTDIR --mandir=$(pwd)/DESTDIR && make && make install && Modified: branches/Onward/things_we_do.txt =================================================================== --- branches/Onward/things_we_do.txt 2010-02-14 21:28:03 UTC (rev 1536) +++ branches/Onward/things_we_do.txt 2010-02-17 03:42:28 UTC (rev 1537) @@ -4,7 +4,7 @@ # In tools we don't let packages install to /tools/libexec/, for consistancy. -# Avoid installing docs to /tools. +# Avoid installing docs to /tools, since we're not going to use them. # It would be nice to optionally strip packages as they're installed. -- http://linuxfromscratch.org/mailman/listinfo/hlfs-book FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
