Changeset 675606b for chapter05/gcc-pass1.xml
- Timestamp:
- 06/16/2020 11:56:28 AM (4 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, 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:
- 9a05e45
- Parents:
- 560065f (diff), 1cd5961 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/gcc-pass1.xml
r560065f r675606b 26 26 27 27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 28 href="../chapter0 6/gcc.xml"28 href="../chapter08/gcc.xml" 29 29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/> 30 30 … … 34 34 35 35 <seglistitem> 36 <seg>&gcc- ch5p1-sbu;</seg>37 <seg>&gcc- ch5p1-du;</seg>36 <seg>&gcc-tmpp1-sbu;</seg> 37 <seg>&gcc-tmpp1-du;</seg> 38 38 </seglistitem> 39 39 </segmentedlist> … … 44 44 <title>Installation of Cross GCC</title> 45 45 46 <para>GCC nowrequires the GMP, MPFR and MPC packages. As these packages may46 <para>GCC requires the GMP, MPFR and MPC packages. As these packages may 47 47 not be included in your host distribution, they will be built with 48 48 GCC. Unpack each package into the GCC source directory and rename the … … 63 63 mv -v mpc-&mpc-version; mpc</userinput></screen> 64 64 65 <para>The following command will change the location of GCC's default 66 dynamic linker to use the one installed in <filename 67 class="directory">/tools</filename>. It also removes <filename 68 class="directory">/usr/include</filename> from GCC's include search path. 69 Issue:</para> 70 71 <screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h 72 do 73 cp -uv $file{,.orig} 74 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ 75 -e 's@/usr@/tools@g' $file.orig > $file 76 echo ' 77 #undef STANDARD_STARTFILE_PREFIX_1 78 #undef STANDARD_STARTFILE_PREFIX_2 79 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" 80 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file 81 touch $file.orig 82 done</userinput></screen> 83 84 <para>In case the above seems hard to follow, let's break it down a bit. 85 First we copy the files <filename>gcc/config/linux.h</filename>, 86 <filename>gcc/config/i386/linux.h</filename>, and 87 <filename>gcc/config/i386/linux64.h</filename> to a file of 88 the same name but with an added suffix of <quote>.orig</quote>. Then the 89 first sed expression prepends <quote>/tools</quote> to every instance of 90 <quote>/lib/ld</quote>, <quote>/lib64/ld</quote> or 91 <quote>/lib32/ld</quote>, while the second one replaces hard-coded 92 instances of <quote>/usr</quote>. Next, we add our define statements which 93 alter the default startfile prefix to the end of the file. Note that the 94 trailing <quote>/</quote> in <quote>/tools/lib/</quote> is required. 95 Finally, we use <command>touch</command> to update the timestamp on the 96 copied files. When used in conjunction with <command>cp -u</command>, this 97 prevents unexpected changes to the original files in case the commands are 98 inadvertently run twice.</para> 99 100 <para>Finally, on x86_64 hosts, set the default directory name for 65 <para>On x86_64 hosts, set the default directory name for 101 66 64-bit libraries to <quote>lib</quote>:</para> 102 67 … … 108 73 esac</userinput></screen> 109 74 110 <!--111 <para>GCC doesn't detect stack protection correctly, which causes problems112 for the build of Glibc-&glibc-version;, so fix that by issuing the following113 command:</para>114 115 <screen><userinput remap="pre">sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure</userinput></screen>116 -->117 118 <!--119 <para>Also fix a problem identified upstream:</para>120 121 <screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&\& \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>122 -->123 75 <para>The GCC documentation recommends building GCC 124 76 in a dedicated build directory:</para> … … 131 83 <screen><userinput remap="configure">../configure \ 132 84 --target=$LFS_TGT \ 133 --prefix= /tools\85 --prefix=$LFS/tools \ 134 86 --with-glibc-version=2.11 \ 135 87 --with-sysroot=$LFS \ 136 88 --with-newlib \ 137 89 --without-headers \ 138 --with-local-prefix=/tools \ 139 --with-native-system-header-dir=/tools/include \ 90 --enable-initfini-array \ 140 91 --disable-nls \ 141 92 --disable-shared \ … … 182 133 183 134 <varlistentry> 184 <term><parameter>--with-local-prefix=/tools</parameter></term> 185 <listitem> 186 <para>The local prefix is the location in the system that GCC will search 187 for locally installed include files. The default is <filename>/usr/local</filename>. 188 Setting this to <filename>/tools</filename> helps keep the host location of 189 <filename>/usr/local</filename> out of this GCC's search path.</para> 190 </listitem> 191 </varlistentry> 192 193 <varlistentry> 194 <term><parameter>--with-native-system-header-dir=/tools/include</parameter></term> 195 <listitem> 196 <para>By default, GCC searches <filename>/usr/include</filename> for 197 system headers. In conjunction with the sysroot switch, this would 198 normally translate to <filename>$LFS/usr/include</filename>. However 199 the headers that will be installed in the next two sections will go 200 to <filename>$LFS/tools/include</filename>. This switch ensures that 201 gcc will find them correctly. In the second pass of GCC, this same 202 switch will ensure that no headers from the host system are 203 found.</para> 135 <term><parameter>--enable-initfini-array</parameter></term> 136 <listitem> 137 <para>This switch forces the use of some internal data structures 138 that are needed but cannot be detected when building a cross 139 compiler.</para> 204 140 </listitem> 205 141 </varlistentry> … … 209 145 <listitem> 210 146 <para>This switch forces GCC to link its internal libraries 211 statically. We do this to avoid possible issues with the host 212 system.</para> 147 statically. We need this because the shared libraries require glibc, 148 which is not yet installed on the target system.</para> 149 </listitem> 150 </varlistentry> 151 152 <varlistentry> 153 <term><parameter>--disable-multilib</parameter></term> 154 <listitem> 155 <para>On x86_64, LFS does not support a multilib configuration. 156 This switch is harmless for x86.</para> 213 157 </listitem> 214 158 </varlistentry> … … 216 160 <varlistentry> 217 161 <term><parameter>--disable-decimal-float, --disable-threads, 218 --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->162 --disable-libatomic, --disable-libgomp, 219 163 --disable-libquadmath, --disable-libssp, --disable-libvtv, 220 164 --disable-libstdcxx</parameter></term> 221 165 <listitem> 222 166 <para>These switches disable support for the decimal floating point 223 extension, threading, libatomic, libgomp, <!--libmpx, -->libquadmath, libssp,167 extension, threading, libatomic, libgomp, libquadmath, libssp, 224 168 libvtv, and the C++ standard library respectively. These features 225 169 will fail to compile when building a cross-compiler and are not … … 229 173 230 174 <varlistentry> 231 <term><parameter>--disable-multilib</parameter></term>232 <listitem>233 <para>On x86_64, LFS does not yet support a multilib configuration.234 This switch is harmless for x86.</para>235 </listitem>236 </varlistentry>237 238 <varlistentry>239 175 <term><parameter>--enable-languages=c,c++</parameter></term> 240 176 <listitem> … … 250 186 <screen><userinput remap="make">make</userinput></screen> 251 187 252 <para>Compilation is now complete. At this point, the test suite would253 normally be run, but, as mentioned before, the test suite framework is254 not in place yet. The benefits of running the tests at this point255 are minimal since the programs from this first pass will soon be256 replaced.</para>257 258 188 <para>Install the package:</para> 259 189 260 <screen><userinput remap="install">make install</userinput></screen> 261 <!-- 262 <para>Using <parameter>- -disable-shared</parameter> means that the 263 <filename>libgcc_eh.a</filename> file isn't created and installed. The 264 Glibc package depends on this library as it uses 265 <parameter>-lgcc_eh</parameter> within its build system. This dependency 266 can be satisfied by creating a symlink to <filename>libgcc.a</filename>, 267 since that file will end up containing the objects normally contained in 268 <filename>libgcc_eh.a</filename>:</para> 269 270 <screen><userinput remap="install">ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&_eh/'`</userinput></screen> 271 --> 190 <screen><userinput remap="install">make install</userinput></screen> 191 192 <para>This build of GCC has installed a couple of internal system 193 headers. Normally one of them, <filename>limits.h</filename>, would in turn 194 include the corresponding system <filename>limits.h</filename> header, in 195 this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the 196 time of this build of GCC <filename>$LFS/usr/include/limits.h</filename> 197 does not exist, so the internal header that has just been installed is a 198 partial, self-contained file and does not include the extended features of 199 the system header. This is adequate for building glibc, but the full 200 internal header will be needed later. Create a full version of the internal 201 header using a command that is identical to what the GCC build system does 202 in normal circumstances:</para> 203 204 <screen><userinput remap="install">cd .. 205 cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ 206 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen> 272 207 </sect2> 273 208
Note:
See TracChangeset
for help on using the changeset viewer.