Upgrade to GCC-4.2.1. Fixes #2002. Merged from jh branch, thanks to Matthew Burgess for preparing a discrete patch.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8374 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Jeremy Huntwork 2007-09-15 20:45:13 +00:00
parent 232aa7359d
commit b0a4c9a47d
11 changed files with 73 additions and 52 deletions

View File

@ -39,6 +39,11 @@
<listitem>
<para>2007-09-15</para>
<itemizedlist>
<listitem>
<para>[jhuntwork] - Upgrade to GCC-4.2.1. Fixes
<ulink url="&lfs-ticket-root;2002">#2002</ulink>.
Thanks to Matthew Burgess for preparing a discrete patch.</para>
</listitem>
<listitem>
<para>[matthew] - Upgrade to DB-4.6.19. Fixes
<ulink url="&lfs-ticket-root;2051">#2051</ulink>.</para>

View File

@ -77,10 +77,10 @@
<!--<listitem>
<para>Gawk &gawk-version;</para>
</listitem>-->
<!--<listitem>
<listitem>
<para>GCC &gcc-version;</para>
</listitem>
<listitem>
<!--<listitem>
<para>Gettext &gettext-version;</para>
</listitem>-->
<!--<listitem>
@ -225,6 +225,10 @@
<para>db-4.5.29-fixes-1.patch</para>
</listitem>
<listitem>
<para>gcc-4.1.2-specs-1.patch</para>
</listitem>
</itemizedlist>
</sect1>

View File

@ -82,14 +82,6 @@
</listitem>
</varlistentry>
<varlistentry>
<term>GCC Specs Patch - <token>&gcc-specs-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&gcc-specs-patch;"/></para>
<para>MD5 sum: <literal>&gcc-specs-patch-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Grep RedHat Fixes Patch - <token>&grep-fixes-patch-size;</token>:</term>
<listitem>

View File

@ -48,7 +48,7 @@ ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld</userinput></screen>
</important>
<!-- Ampersands are needed to allow copy and paste -->
<screen><userinput>gcc -dumpspecs | sed 's@^/lib/ld-linux.so.2@/tools&amp;@g' \
<screen><userinput>gcc -dumpspecs | sed 's@/lib/ld-linux.so.2@/tools&amp;@g' \
> `dirname $(gcc -print-libgcc-file-name)`/specs</userinput></screen>
<para>During the build process, GCC runs a script

View File

@ -101,26 +101,15 @@ cd ../gcc-build</userinput></screen>
</variablelist>
<para>Continue with compiling the package:</para>
<para>The following command will compile GCC not once, but several times. It
uses the programs compiled in a first round to compile itself a second time,
and then again a third time. It then compares these second and third compiles
to make sure it can reproduce itself flawlessly. This is called
<quote>bootstrapping</quote>. Building GCC in this way ensures that it was
compiled correctly and is now the default configuration for the released
package. Continue with compiling by running:</para>
<screen><userinput>make bootstrap</userinput></screen>
<variablelist>
<title>The meaning of the make parameter:</title>
<varlistentry>
<term><parameter>bootstrap</parameter></term>
<listitem>
<para>This target does not just compile GCC, but compiles it
several times. It uses the programs compiled in a first round
to compile itself a second time, and then again a third time.
It then compares these second and third compiles to make sure
it can reproduce itself flawlessly. This also implies that it
was compiled correctly.</para>
</listitem>
</varlistentry>
</variablelist>
<screen><userinput>make</userinput></screen>
<para>Compilation is now complete. At this point, the test suite would
normally be run, but, as mentioned before, the test suite framework is

View File

@ -90,23 +90,39 @@ sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig &gt; gcc/Makefile.in</userin
sed 's/^XCFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in.tmp \
&gt; gcc/Makefile.in</userinput></screen>
<para>Apply the following patch to change the location of GCC's default
dynamic linker (typically <filename
class="libraryfile">ld-linux.so.2</filename>):</para>
<screen><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
<para>The above patch also removes <filename
<para>The following command will change the location of GCC's default
dynamic linker to use the one we installed in
<filename class="directory">/tools</filename>. It also removes <filename
class="directory">/usr/include</filename> from GCC's include search path.
Patching now rather than adjusting the specs file after installation
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.</para>
against the new Glibc. Issue:</para>
<important>
<para>The above patch is critical in ensuring a successful overall
build. Do not forget to apply it.</para>
</important>
<screen><userinput>for file in $(find gcc/config -name linux64.h -o -name linux.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
echo "
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR 0" &gt;&gt; $file
touch $file.orig
done</userinput></screen>
<para>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 <filename>linux.h</filename> or <filename>linux64.h</filename>.
For each file found, we copy it to a file of the same name but with an added
suffix of <quote>.orig</quote>. Then the first sed expression prepends
<quote>/tools</quote> to every instance of <quote>/lib/ld</quote>,
<quote>/lib64/ld</quote> or <quote>/lib32/ld</quote>, while the second one
replaces hard-coded instances of <quote>/usr</quote>. Then we add our define
statements which alter the include search path to the end of the file. Finally,
we use <command>touch</command> to update the timestamp on the copied files.
When used in conjunction with <command>cp -u</command>, this prevents unexpected
changes to the original files in case the command is inadvertently run twice.
</para>
<para>Create a separate build directory again:</para>
@ -122,7 +138,7 @@ cd ../gcc-build</userinput></screen>
--with-local-prefix=/tools --enable-clocale=gnu \
--enable-shared --enable-threads=posix \
--enable-__cxa_atexit --enable-languages=c,c++ \
--disable-libstdcxx-pch</userinput></screen>
--disable-libstdcxx-pch --disable-bootstrap</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
@ -177,6 +193,15 @@ cd ../gcc-build</userinput></screen>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-bootstrap</parameter></term>
<listitem>
<para>Bootstrapping the compiler is now the default for GCC. However,
our build method should provide us with a solid compiler without the
need to bootstrap each time.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>

View File

@ -48,6 +48,11 @@
<screen><userinput>patch -Np1 -i ../&perl-libc-patch;</userinput></screen>
<para>Fix an incompatibility with gcc-&gcc-version;:</para>
<screen><userinput>mv -v makedepend.SH{,.orig}
sed 's/command /command[ -]/' makedepend.SH.orig &gt; makedepend.SH</userinput></screen>
<para>Prepare Perl for compilation (make sure to get the
'Data/Dumper Fcntl IO POSIX' part of the command correct&mdash;they are all
letters):</para>

View File

@ -83,7 +83,8 @@ cd ../gcc-build</userinput></screen>
<screen><userinput>../gcc-&gcc-version;/configure --prefix=/usr \
--libexecdir=/usr/lib --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-clocale=gnu --enable-languages=c,c++</userinput></screen>
--enable-clocale=gnu --enable-languages=c,c++ \
--disable-bootstrap</userinput></screen>
<para>Compile the package:</para>

View File

@ -47,6 +47,10 @@
<screen><userinput>echo "127.0.0.1 localhost $(hostname)" &gt; /etc/hosts</userinput></screen>
<para>Fix an incompatibility with gcc-&gcc-version;:</para>
<screen><userinput>sed -i 's/command /command[ -]/' makedepend.SH</userinput></screen>
<para>To have full control over the way Perl is set up, you can run the
interactive <command>Configure</command> script and hand-pick the way this
package is built. If you prefer, you can use the defaults that Perl

View File

@ -168,10 +168,10 @@
<!ENTITY gawk-ch6-du "18.2 MB">
<!ENTITY gawk-ch6-sbu "0.2 SBU">
<!ENTITY gcc-version "4.1.2">
<!ENTITY gcc-size "38,777 KB">
<!ENTITY gcc-version "4.2.1">
<!ENTITY gcc-size "43,029 KB">
<!ENTITY gcc-url "&gnu;gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
<!ENTITY gcc-md5 "a4a3eb15c96030906d8494959eeda23c">
<!ENTITY gcc-md5 "cba410e6ff70f7d7f4be7a0267707fd0">
<!ENTITY gcc-home "http://gcc.gnu.org/">
<!ENTITY gcc-ch5p1-du "655 MB">
<!ENTITY gcc-ch5p1-sbu "9.2 SBU">

View File

@ -39,10 +39,6 @@
<!ENTITY gawk-segfault-patch-size "1.3 KB">
<!ENTITY gcc-specs-patch "gcc-&gcc-version;-specs-1.patch">
<!ENTITY gcc-specs-patch-md5 "a17be8ccfb978e73f382be5093dd8abd">
<!ENTITY gcc-specs-patch-size "14.8 KB">
<!ENTITY grep-fixes-patch "grep-&grep-version;-redhat_fixes-2.patch">
<!ENTITY grep-fixes-patch-md5 "2c67910be2d0a54714f63ce350e6d8a6">
<!ENTITY grep-fixes-patch-size "55 KB">