aboutsummaryrefslogtreecommitdiffstats
path: root/chapter05/gcc-pass2.xml
diff options
context:
space:
mode:
authorJeremy Huntwork <jhuntwork@linuxfromscratch.org>2007-09-15 20:45:13 +0000
committerJeremy Huntwork <jhuntwork@linuxfromscratch.org>2007-09-15 20:45:13 +0000
commitb0a4c9a47dadc3ab2c37a034866cb542f3fffa0b (patch)
treefb6d77a8ace59cc4de2eec8cfb96a5cd29983fa1 /chapter05/gcc-pass2.xml
parent232aa7359d4f119b062bf270e19e8a4c1d2228a0 (diff)
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
Diffstat (limited to 'chapter05/gcc-pass2.xml')
-rw-r--r--chapter05/gcc-pass2.xml55
1 files changed, 40 insertions, 15 deletions
diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml
index 53743acb6..2be683d55 100644
--- a/chapter05/gcc-pass2.xml
+++ b/chapter05/gcc-pass2.xml
@@ -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>
-
- <important>
- <para>The above patch is critical in ensuring a successful overall
- build. Do not forget to apply it.</para>
- </important>
+ against the new Glibc. Issue:</para>
+
+<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>