|
@@ -84,30 +84,47 @@ sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in</userin
|
|
sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
|
|
sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
|
|
> gcc/Makefile.in</userinput></screen>
|
|
> 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-x86-64.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.
|
|
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
|
|
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
|
|
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&@g' \
|
|
|
|
+ -e 's@/usr@/tools@g' $file.orig > $file
|
|
|
|
+ echo "
|
|
|
|
+#undef STANDARD_INCLUDE_DIR
|
|
|
|
+#define STANDARD_INCLUDE_DIR 0" >> $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
|
|
|
|
+ statments altering 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>Unsetting the multlib spec for GCC ensures that it
|
|
<para>Unsetting the multlib spec for GCC ensures that it
|
|
won't attempt to link against libraries on the host:</para>
|
|
won't attempt to link against libraries on the host:</para>
|
|
|
|
|
|
-<screen><userinput>cp gcc/config/i386/t-linux64{,.tmp}
|
|
|
|
-sed '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64.tmp \
|
|
|
|
- > gcc/config/i386/t-linux64</userinput></screen>
|
|
|
|
|
|
+<screen><userinput>for file in $(find gcc/config -name t-linux64) ; do \
|
|
|
|
+ cp -v $file{,.orig}
|
|
|
|
+ sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file
|
|
|
|
+done</userinput></screen>
|
|
|
|
|
|
<para>Create a separate build directory again:</para>
|
|
<para>Create a separate build directory again:</para>
|
|
|
|
|