Changeset 1a3e6a3 for chapter05/gcc-pass2.xml
- Timestamp:
- 04/25/2012 07:26:21 PM (12 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- cd3c10c
- Parents:
- e625c49
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/gcc-pass2.xml
re625c49 r1a3e6a3 44 44 <title>Installation of GCC</title> 45 45 46 <para>Versions of GCC later than 4.3 will treat this build as if 47 it were a relocated compiler and disallow searching for startfiles in 48 the location specified by <parameter>--prefix</parameter>. Since this 49 will not be a relocated compiler, and the startfiles in 50 <filename class="directory">/tools</filename> are crucial to building 51 a working compiler linked to the libs in <filename class="directory">/tools</filename>, 52 apply the following patch which partially reverts GCC to its old behavior:</para> 53 54 <screen><userinput remap="pre">patch -Np1 -i ../&gcc-startfiles-patch;</userinput></screen> 46 <para>Our first build of GCC has installed a couple of internal system 47 headers. Normally one of them, <filename>limits.h</filename> will in turn 48 include the corresponding system <filename>limits.h</filename> header, in 49 this case, <filename>/tools/include/limits.h</filename>. However, at the 50 time of the first build of gcc <filename>/tools/include/limits.h</filename> 51 did not exist, so the internal header that GCC installed is a partial, 52 self-contained file and does not include the extended features of the 53 system header. This was adequate for building the temporary libc, but this 54 build of GCC now requires the full internal header. Create a full version 55 of the internal header using a command that is identical to what the GCC 56 build system does in normal circumstances:</para> 57 58 <screen><userinput remap="pre">cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ 59 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h</userinput></screen> 55 60 56 61 <para>Under normal circumstances the GCC <command>fixincludes</command> script … … 77 82 > gcc/Makefile.in</userinput></screen> 78 83 79 <para>The following command will change the location of GCC's default 80 dynamic linker to use the one installed in 81 <filename class="directory">/tools</filename>. It also removes <filename 82 class="directory">/usr/include</filename> from GCC's include search path. 83 Doing this now rather than adjusting the specs file after installation 84 ensures that the new dynamic linker is used during the actual build of 85 GCC. That is, all of the binaries created during the build will link 86 against the new Glibc. Issue:</para> 84 <para>Once again, change the location of GCC's default dynamic linker to 85 use the one installed in <filename 86 class="directory">/tools</filename>.</para> 87 87 88 88 <screen><userinput remap="pre">for file in \ … … 95 95 #undef STANDARD_STARTFILE_PREFIX_1 96 96 #undef STANDARD_STARTFILE_PREFIX_2 97 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib "97 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" 98 98 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file 99 99 touch $file.orig 100 100 done</userinput></screen> 101 102 <para>In case the above seems hard to follow, let's break it down a bit.103 First we find all the files under the104 <filename class="directory">gcc/config</filename> directory that are named105 either <filename>linux.h</filename>, <filename>linux64.h</filename> or106 <filename>sysv4.h</filename>.107 For each file found, we copy it to a file of the same name but with an added108 suffix of <quote>.orig</quote>. Then the first sed expression prepends109 <quote>/tools</quote> to every instance of <quote>/lib/ld</quote>,110 <quote>/lib64/ld</quote> or <quote>/lib32/ld</quote>, while the second one111 replaces hard-coded instances of <quote>/usr</quote>. Then we add our define112 statements which alter the include search path and the default startfile prefix113 to the end of the file.114 Finally, we use <command>touch</command> to update the timestamp on the copied files.115 When used in conjunction with <command>cp -u</command>, this prevents unexpected116 changes to the original files in case the commands are inadvertently run twice.117 </para>118 119 <para>On x86_64, unsetting the multilib spec for GCC ensures that it120 won't attempt to link against libraries on the host:</para>121 122 <screen><userinput remap="pre">case $(uname -m) in123 x86_64)124 for file in $(find gcc/config -name t-linux64) ; do \125 cp -v $file{,.orig}126 sed '/MULTILIB_OSDIRNAMES/d' $file.orig > $file127 done128 ;;129 esac</userinput></screen>130 101 131 102 <para>As in the first build of GCC it requires the GMP, MPFR and MPC … … 150 121 <para>Now prepare GCC for compilation:</para> 151 122 152 <screen><userinput remap="configure">CC="$LFS_TGT-gcc -B/tools/lib/" \123 <screen><userinput remap="configure">CC="$LFS_TGT-gcc" \ 153 124 AR=$LFS_TGT-ar \ 154 125 RANLIB=$LFS_TGT-ranlib \ … … 156 127 --prefix=/tools \ 157 128 --with-local-prefix=/tools \ 129 --with-native-system-header-dir=/tools/include \ 158 130 --enable-clocale=gnu \ 159 131 --enable-shared \ … … 165 137 --disable-bootstrap \ 166 138 --disable-libgomp \ 167 --without-ppl \168 --without-cloog \169 139 --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \ 170 140 --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen>
Note:
See TracChangeset
for help on using the changeset viewer.