| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
 | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
 | 
|---|
| 3 |   "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
 | 
|---|
| 4 |   <!ENTITY % general-entities SYSTEM "../../general.ent">
 | 
|---|
| 5 |   %general-entities;
 | 
|---|
| 6 | ]>
 | 
|---|
| 7 | 
 | 
|---|
| 8 | <sect1 id="ch-cross-tools-gcc-static" role="wrap">
 | 
|---|
| 9 |   <?dbhtml filename="gcc-static.html"?>
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   <title>Cross GCC-&gcc-version; - Static</title>
 | 
|---|
| 12 | 
 | 
|---|
| 13 |   <indexterm zone="ch-cross-tools-gcc-static">
 | 
|---|
| 14 |     <primary sortas="a-GCC">GCC</primary>
 | 
|---|
| 15 |     <secondary>cross tools, static</secondary>
 | 
|---|
| 16 |   </indexterm>
 | 
|---|
| 17 | 
 | 
|---|
| 18 |   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 19 |   href="../../final-system/common/gcc.xml"
 | 
|---|
| 20 |   xpointer="xpointer(//*[@role='package'])"/>
 | 
|---|
| 21 | 
 | 
|---|
| 22 |   <sect2 role="installation">
 | 
|---|
| 23 |     <title>Installation of Cross GCC Compiler with Static libgcc
 | 
|---|
| 24 |     and no Threads</title>
 | 
|---|
| 25 | 
 | 
|---|
| 26 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 27 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 28 |     xpointer="xpointer(//*[@os='p1'])"/>
 | 
|---|
| 29 | 
 | 
|---|
| 30 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 31 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 32 |     xpointer="xpointer(//*[@os='p2'])"/>
 | 
|---|
| 33 | 
 | 
|---|
| 34 |     <para os="aa">Make a couple of essential adjustments to the
 | 
|---|
| 35 |     <filename>specs</filename> file to ensure GCC uses our build
 | 
|---|
| 36 |     environment:</para>
 | 
|---|
| 37 | 
 | 
|---|
| 38 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
 | 
|---|
| 39 | 
 | 
|---|
| 40 |     <para os="ag">Change the StartFile Spec so that GCC looks in 
 | 
|---|
| 41 | <filename class="directory">/tools</filename>:</para>
 | 
|---|
| 42 | 
 | 
|---|
| 43 | <screen os="ah"><userinput>echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h
 | 
|---|
| 44 | echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h</userinput></screen>
 | 
|---|
| 45 | 
 | 
|---|
| 46 |     <para os="t1">We will create a dummy <filename>limits.h</filename> so
 | 
|---|
| 47 |     the build will not use the one provided by the host distro:</para>
 | 
|---|
| 48 | 
 | 
|---|
| 49 | <screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
 | 
|---|
| 50 | 
 | 
|---|
| 51 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 52 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 53 |     xpointer="xpointer(//*[@os='f'])"/>
 | 
|---|
| 54 | 
 | 
|---|
| 55 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 56 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 57 |     xpointer="xpointer(//*[@os='g'])"/>
 | 
|---|
| 58 | 
 | 
|---|
| 59 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 60 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 61 |     xpointer="xpointer(//*[@os='h'])"/>
 | 
|---|
| 62 | 
 | 
|---|
| 63 | <screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
 | 
|---|
| 64 |   ../gcc-&gcc-version;/configure --prefix=/cross-tools \
 | 
|---|
| 65 |   --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \
 | 
|---|
| 66 |   --with-sysroot=${CLFS} --with-local-prefix=/tools \
 | 
|---|
| 67 |   --with-native-system-header-dir=/tools/include --disable-nls \
 | 
|---|
| 68 |   --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \
 | 
|---|
| 69 |   --with-isl=/cross-tools --with-cloog=/cross-tools --with-mpc=/cross-tools \
 | 
|---|
| 70 |   --without-headers --with-newlib --disable-decimal-float --disable-libgomp \
 | 
|---|
| 71 |   --disable-libmudflap --disable-libssp --disable-threads --disable-multilib \
 | 
|---|
| 72 |   --disable-libatomic --disable-libitm --disable-libsanitizer \
 | 
|---|
| 73 |   --disable-libquadmath --disable-target-zlib \
 | 
|---|
| 74 |   --with-system-zlib --enable-cloog-backend=isl --disable-isl-version-check \
 | 
|---|
| 75 |   --enable-languages=c --enable-checking=release</userinput></screen>
 | 
|---|
| 76 | 
 | 
|---|
| 77 |     <variablelist os="am">
 | 
|---|
| 78 |       <title>The meaning of the new configure options:</title>
 | 
|---|
| 79 | 
 | 
|---|
| 80 |       <varlistentry>
 | 
|---|
| 81 |         <term><parameter>--with-sysroot=${CLFS}</parameter></term>
 | 
|---|
| 82 |         <listitem>
 | 
|---|
| 83 |           <para>Tells GCC to consider ${CLFS} as the root file system.</para>
 | 
|---|
| 84 |         </listitem>
 | 
|---|
| 85 |       </varlistentry>
 | 
|---|
| 86 | 
 | 
|---|
| 87 |      <varlistentry>
 | 
|---|
| 88 |         <term><parameter>--with-local-prefix=/tools</parameter></term>
 | 
|---|
| 89 |         <listitem>
 | 
|---|
| 90 |           <para>The purpose of this switch is to remove <filename
 | 
|---|
| 91 |           class="directory">/usr/local/include</filename> from
 | 
|---|
| 92 |           <command>gcc</command>'s include search path. This is not
 | 
|---|
| 93 |           absolutely essential, however, it helps to minimize the
 | 
|---|
| 94 |           influence of the host system.</para>
 | 
|---|
| 95 |         </listitem>
 | 
|---|
| 96 |       </varlistentry>
 | 
|---|
| 97 | 
 | 
|---|
| 98 | 
 | 
|---|
| 99 |       <varlistentry>
 | 
|---|
| 100 |         <term><parameter>--with-native-system-headers-dir=/tools/include</parameter></term>
 | 
|---|
| 101 |         <listitem>
 | 
|---|
| 102 |           <para>This switch ensures that GCC will search for the system headers
 | 
|---|
| 103 |            in <filename class="directory">/tools/include</filename> and that
 | 
|---|
| 104 |            host system headers will not be searched.</para>
 | 
|---|
| 105 |         </listitem>
 | 
|---|
| 106 |       </varlistentry>
 | 
|---|
| 107 | 
 | 
|---|
| 108 |       <varlistentry>
 | 
|---|
| 109 |         <term><parameter>--disable-nls</parameter></term>
 | 
|---|
| 110 |         <listitem>
 | 
|---|
| 111 |           <para>This disables internationalization as i18n is not needed for the
 | 
|---|
| 112 |           cross-compile tools.</para>
 | 
|---|
| 113 |         </listitem>
 | 
|---|
| 114 |       </varlistentry>
 | 
|---|
| 115 | 
 | 
|---|
| 116 |       <varlistentry>
 | 
|---|
| 117 |         <term><parameter>--without-headers</parameter></term>
 | 
|---|
| 118 |         <listitem>
 | 
|---|
| 119 |           <para>Disables GCC from using the target's Libc when cross compiling.</para>
 | 
|---|
| 120 |         </listitem>
 | 
|---|
| 121 |       </varlistentry>
 | 
|---|
| 122 | 
 | 
|---|
| 123 |       <varlistentry>
 | 
|---|
| 124 |         <term><parameter>--with-newlib</parameter></term>
 | 
|---|
| 125 |         <listitem>
 | 
|---|
| 126 |           <para>Tells GCC that the target libc will use 'newlib'.</para>
 | 
|---|
| 127 |         </listitem>
 | 
|---|
| 128 |       </varlistentry>
 | 
|---|
| 129 | 
 | 
|---|
| 130 |       <varlistentry>
 | 
|---|
| 131 |         <term><parameter>--disable-decimal-float</parameter></term>
 | 
|---|
| 132 |         <listitem>
 | 
|---|
| 133 |           <para>Disables support for the C decimal floating point extension.</para>
 | 
|---|
| 134 |         </listitem>
 | 
|---|
| 135 |       </varlistentry>
 | 
|---|
| 136 | 
 | 
|---|
| 137 |       <varlistentry>
 | 
|---|
| 138 |         <term><parameter>--disable-libgomp</parameter></term>
 | 
|---|
| 139 |         <listitem>
 | 
|---|
| 140 |           <para>Disables the creation of runtime libraries used by GOMP.</para>
 | 
|---|
| 141 |         </listitem>
 | 
|---|
| 142 |       </varlistentry>
 | 
|---|
| 143 | 
 | 
|---|
| 144 |       <varlistentry>
 | 
|---|
| 145 |         <term><parameter>--disable-libmudflap</parameter></term>
 | 
|---|
| 146 |         <listitem>
 | 
|---|
| 147 |           <para>Disables the creation of runtime libaries used by libmudflap.</para>
 | 
|---|
| 148 |         </listitem>
 | 
|---|
| 149 |       </varlistentry>
 | 
|---|
| 150 | 
 | 
|---|
| 151 |       <varlistentry>
 | 
|---|
| 152 |         <term><parameter>--disable-libssp</parameter></term>
 | 
|---|
| 153 |         <listitem>
 | 
|---|
| 154 |           <para>Disables the use of Stack Smashing Protection for runtime libraries.</para>
 | 
|---|
| 155 |         </listitem>
 | 
|---|
| 156 |       </varlistentry>
 | 
|---|
| 157 | 
 | 
|---|
| 158 |       <varlistentry>
 | 
|---|
| 159 |         <term><parameter>--disable-threads</parameter></term>
 | 
|---|
| 160 |         <listitem>
 | 
|---|
| 161 |           <para>This will prevent GCC from looking for the multi-thread
 | 
|---|
| 162 |           include files, since they haven't been created for this architecture
 | 
|---|
| 163 |           yet. GCC will be able to find the multi-thread information after
 | 
|---|
| 164 |           the Glibc headers are created.</para>
 | 
|---|
| 165 |         </listitem>
 | 
|---|
| 166 |       </varlistentry>
 | 
|---|
| 167 | 
 | 
|---|
| 168 |       <varlistentry>
 | 
|---|
| 169 |         <term><parameter>--disable-libatomic</parameter></term>
 | 
|---|
| 170 |         <listitem>
 | 
|---|
| 171 |           <para>The atomic library isn't needed at this time.</para>
 | 
|---|
| 172 |         </listitem>
 | 
|---|
| 173 |       </varlistentry>
 | 
|---|
| 174 | 
 | 
|---|
| 175 |       <varlistentry>
 | 
|---|
| 176 |         <term><parameter>--disable-libitm</parameter></term>
 | 
|---|
| 177 |         <listitem>
 | 
|---|
| 178 |           <para>The itm library isn't neeeded at this tiem.</para>
 | 
|---|
| 179 |         </listitem>
 | 
|---|
| 180 |       </varlistentry>
 | 
|---|
| 181 | 
 | 
|---|
| 182 |       <varlistentry>
 | 
|---|
| 183 |         <term><parameter>--disable-libsanitizer</parameter></term>
 | 
|---|
| 184 |         <listitem>
 | 
|---|
| 185 |           <para>The sanitizer library isn't needed at this time.</para>
 | 
|---|
| 186 |         </listitem>
 | 
|---|
| 187 |       </varlistentry>
 | 
|---|
| 188 | 
 | 
|---|
| 189 |       <varlistentry>
 | 
|---|
| 190 |         <term><parameter>--disable-libquadmath</parameter></term>
 | 
|---|
| 191 |         <listitem>
 | 
|---|
| 192 |           <para>The quadmath library isn't needed at this time.</para>
 | 
|---|
| 193 |         </listitem>
 | 
|---|
| 194 |       </varlistentry>
 | 
|---|
| 195 | 
 | 
|---|
| 196 |       <varlistentry>
 | 
|---|
| 197 |         <term><parameter>--enable-languages=c</parameter></term>
 | 
|---|
| 198 |         <listitem>
 | 
|---|
| 199 |           <para>This option ensures that only the C compiler is built.</para>
 | 
|---|
| 200 |         </listitem>
 | 
|---|
| 201 |       </varlistentry>
 | 
|---|
| 202 | 
 | 
|---|
| 203 |       <varlistentry>
 | 
|---|
| 204 |         <term><parameter>--enable-checking=release</parameter></term>
 | 
|---|
| 205 |         <listitem>
 | 
|---|
| 206 |           <para>This option selects the complexity of the internal consistency checks and adds error checking within the compiler.</para>
 | 
|---|
| 207 |         </listitem>
 | 
|---|
| 208 |       </varlistentry>
 | 
|---|
| 209 | 
 | 
|---|
| 210 |     </variablelist>
 | 
|---|
| 211 | 
 | 
|---|
| 212 |     <para os="an">Continue with compiling the package:</para>
 | 
|---|
| 213 | 
 | 
|---|
| 214 | <screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen>
 | 
|---|
| 215 | 
 | 
|---|
| 216 |     <variablelist os="ap">
 | 
|---|
| 217 |       <title>The meaning of the new make options:</title>
 | 
|---|
| 218 | 
 | 
|---|
| 219 |       <varlistentry>
 | 
|---|
| 220 |         <term><parameter>all-gcc all-target-libgcc</parameter></term>
 | 
|---|
| 221 |         <listitem>
 | 
|---|
| 222 |           <para>Compiles only the parts of GCC that are needed at this time,
 | 
|---|
| 223 |           rather than the full package.</para>
 | 
|---|
| 224 |         </listitem>
 | 
|---|
| 225 |       </varlistentry>
 | 
|---|
| 226 | 
 | 
|---|
| 227 |     </variablelist>
 | 
|---|
| 228 | 
 | 
|---|
| 229 |     <para os="aq">Install the package:</para>
 | 
|---|
| 230 | 
 | 
|---|
| 231 | <screen os="ar"><userinput>make install-gcc install-target-libgcc</userinput></screen>
 | 
|---|
| 232 | 
 | 
|---|
| 233 |     <para os="as">Copy <filename class="headerfile">libiberty.h</filename> to
 | 
|---|
| 234 |     <filename class="directory">/tools/include</filename> directory:</para>
 | 
|---|
| 235 | 
 | 
|---|
| 236 | <screen os="at"><userinput>cp -v ../gcc-&gcc-version;/include/libiberty.h /tools/include</userinput></screen>
 | 
|---|
| 237 | 
 | 
|---|
| 238 |   </sect2>
 | 
|---|
| 239 | 
 | 
|---|
| 240 |   <sect2 role="content">
 | 
|---|
| 241 |     <title/>
 | 
|---|
| 242 | 
 | 
|---|
| 243 |     <para>Details on this package are located in <xref
 | 
|---|
| 244 |     linkend="contents-gcc" role="."/></para>
 | 
|---|
| 245 | 
 | 
|---|
| 246 |   </sect2>
 | 
|---|
| 247 | 
 | 
|---|
| 248 | </sect1>
 | 
|---|