[43f755b] | 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 |
|
---|
[d258427] | 8 | <sect1 id="ch-cross-tools-toolchain" role="wrap">
|
---|
| 9 | <?dbhtml filename="toolchain.html"?>
|
---|
[43f755b] | 10 |
|
---|
[d258427] | 11 | <title>Toolchain</title>
|
---|
[43f755b] | 12 |
|
---|
[d258427] | 13 | <indexterm zone="ch-cross-tools-toolchain">
|
---|
| 14 | <primary sortas="a-toolchain">ToolChain</primary>
|
---|
| 15 | <secondary>cross tools</secondary>
|
---|
[43f755b] | 16 | </indexterm>
|
---|
| 17 |
|
---|
[d258427] | 18 | <sect2 role="package">
|
---|
| 19 | <title/>
|
---|
| 20 |
|
---|
| 21 | <para>This section combines Binutils, GCC, GMP, and MPFR packages
|
---|
| 22 | to create a clean toolchain.</para>
|
---|
| 23 |
|
---|
| 24 | </sect2>
|
---|
[43f755b] | 25 |
|
---|
| 26 | <sect2 role="installation">
|
---|
[d258427] | 27 | <title>Installation of our Toolchain</title>
|
---|
| 28 |
|
---|
| 29 | <para os="na">We are going to extract all the files needed
|
---|
| 30 | to create our toolchain:</para>
|
---|
| 31 |
|
---|
| 32 | <screen os="nb"><userinput>tar -jxf ../gcc-&gcc-version;.tar.bz2
|
---|
| 33 | tar -jxf ../binutils-&binutils-version;.tar.bz2
|
---|
| 34 | tar -jxf ../mfpr-&mpfr-version;.tar.bz2
|
---|
| 35 | tar -jxf ../gmp-&gmp-version;.tar.bz2</userinput></screen>
|
---|
| 36 |
|
---|
| 37 | <para os="nc">We are going to create a combined directory for
|
---|
| 38 | or build:</para>
|
---|
| 39 |
|
---|
| 40 | <screen os="nd"><userinput>mkdir -pv sysroot-toolchain
|
---|
| 41 | cd gcc-&gcc-version;; tar -c * | \
|
---|
| 42 | ( cd ../sysroot-toolchain ; tar xf - )
|
---|
| 43 | cd ../binutils-&binutils-version;; tar -c * | \
|
---|
| 44 | ( cd ../sysroot-toolchain ; tar xf - )
|
---|
| 45 | cd ../sysroot-toolchain
|
---|
| 46 | mv ../mpfr-&mpfr-version; ./mpfr
|
---|
| 47 | mv ../gmp-&gmp-version; ./gmp</userinput></screen>
|
---|
| 48 |
|
---|
| 49 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 50 | href="../common/binutils.xml"
|
---|
| 51 | xpointer="xpointer(//*[@os='ba'])"/>
|
---|
| 52 |
|
---|
| 53 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 54 | href="../common/binutils.xml"
|
---|
| 55 | xpointer="xpointer(//*[@os='bb'])"/>
|
---|
| 56 |
|
---|
| 57 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 58 | href="../common/binutils.xml"
|
---|
| 59 | xpointer="xpointer(//*[@os='p1'])"/>
|
---|
| 60 |
|
---|
| 61 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 62 | href="../common/binutils.xml"
|
---|
| 63 | xpointer="xpointer(//*[@os='p2'])"/>
|
---|
[43f755b] | 64 |
|
---|
| 65 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 66 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 67 | xpointer="xpointer(//*[@os='p1'])"/>
|
---|
| 68 |
|
---|
| 69 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 70 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 71 | xpointer="xpointer(//*[@os='p2'])"/>
|
---|
| 72 |
|
---|
| 73 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 74 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 75 | xpointer="xpointer(//*[@os='aa'])"/>
|
---|
| 76 |
|
---|
| 77 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 78 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 79 | xpointer="xpointer(//*[@os='ab'])"/>
|
---|
| 80 |
|
---|
| 81 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 82 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 83 | xpointer="xpointer(//*[@os='ac'])"/>
|
---|
| 84 |
|
---|
| 85 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 86 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 87 | xpointer="xpointer(//*[@os='ad'])"/>
|
---|
| 88 |
|
---|
[be71788] | 89 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 90 | href="../../temp-system/common/gmp.xml"
|
---|
| 91 | xpointer="xpointer(//*[@os='p1'])"/>
|
---|
| 92 |
|
---|
| 93 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
| 94 | href="../../temp-system/common/gmp.xml"
|
---|
| 95 | xpointer="xpointer(//*[@os='p2'])"/>
|
---|
| 96 |
|
---|
[5857ae7] | 97 | <para os="ng">This ensures by default the compiler will look in
|
---|
| 98 | /tools/lib/../lib or /tools/lib/../lib64 as appropriate:</para>
|
---|
[43f755b] | 99 |
|
---|
[5857ae7] | 100 | <screen os="nh"><userinput>echo "
|
---|
| 101 | #undef STANDARD_STARTFILE_PREFIX_1
|
---|
| 102 | #undef STANDARD_STARTFILE_PREFIX_2
|
---|
| 103 | #define STANDARD_STARTFILE_PREFIX_1 \"/tools/lib/\"
|
---|
| 104 | #define STANDARD_STARTFILE_PREFIX_2 \"\"" >> gcc/config/linux.h</userinput></screen>
|
---|
[43f755b] | 105 |
|
---|
| 106 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 107 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 108 | xpointer="xpointer(//*[@os='ai'])"/>
|
---|
| 109 |
|
---|
| 110 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 111 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 112 | xpointer="xpointer(//*[@os='aj'])"/>
|
---|
| 113 |
|
---|
| 114 | <para os="bd">Finally, disable <option>-B</option> in <filename>configure</filename>,
|
---|
| 115 | so it doesn't pick up the host's header files:</para>
|
---|
| 116 |
|
---|
| 117 | <screen os="be"><userinput>cp -v configure{,.orig}
|
---|
| 118 | sed -e '/FLAGS_FOR_TARGET.*\/lib\//s@-B[^ ]*/lib/@@g' configure.orig > \
|
---|
| 119 | configure</userinput></screen>
|
---|
| 120 |
|
---|
| 121 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
---|
[d258427] | 122 | href="../common/gcc-static.xml"
|
---|
[43f755b] | 123 | xpointer="xpointer(//*[@os='f'])"/>
|
---|
| 124 |
|
---|
[d258427] | 125 | <screen os="bf"><userinput>AR=ar AS=as ../sysroot-toolchain/configure \
|
---|
| 126 | --with-sysroot=${CLFS} --prefix=/cross-tools \
|
---|
| 127 | --target=i686-pc-linux-gnu --with-local-prefix=/tools \
|
---|
| 128 | --without-headers --with-newlib --disable-nls \
|
---|
| 129 | --disable-shared --disable-decimal-float --disable-libgomp \
|
---|
| 130 | --disable-libmudflap --disable-libssp --disable-threads \
|
---|
| 131 | --enable-languages=c --enable-64-bit-bfd --with-lib-path=/tools/lib</userinput></screen>
|
---|
[43f755b] | 132 |
|
---|
| 133 | <variablelist os="bg">
|
---|
| 134 | <title>The meaning of the new configure options:</title>
|
---|
| 135 |
|
---|
| 136 | <varlistentry os="bg1">
|
---|
| 137 | <term><parameter>--enable-languages=c,c++</parameter></term>
|
---|
| 138 | <listitem>
|
---|
| 139 | <para>This option ensures that only the C and C++ compilers are built.</para>
|
---|
| 140 | </listitem>
|
---|
| 141 | </varlistentry>
|
---|
| 142 |
|
---|
| 143 | <varlistentry os="bg2">
|
---|
| 144 | <term><parameter>--enable-__cxa_atexit</parameter></term>
|
---|
| 145 | <listitem>
|
---|
| 146 | <para>This option allows use of __cxa_atexit, rather than atexit,
|
---|
| 147 | to register C++ destructors for local statics and global objects
|
---|
| 148 | and is essential for fully standards-compliant handling of destructors.
|
---|
| 149 | It also affects the C++ ABI and therefore results in C++ shared libraries
|
---|
| 150 | and C++ programs that are interoperable with other Linux distributions.</para>
|
---|
| 151 | </listitem>
|
---|
| 152 | </varlistentry>
|
---|
| 153 |
|
---|
| 154 | <varlistentry os="bg3">
|
---|
| 155 | <term><parameter>--enable-c99</parameter></term>
|
---|
| 156 | <listitem>
|
---|
| 157 | <para>Enable C99 support for C programs.</para>
|
---|
| 158 | </listitem>
|
---|
| 159 | </varlistentry>
|
---|
| 160 |
|
---|
| 161 | <varlistentry os="bg4">
|
---|
| 162 | <term><parameter>--enable-long-long</parameter></term>
|
---|
| 163 | <listitem>
|
---|
| 164 | <para>Enables long long support in the compiler.</para>
|
---|
| 165 | </listitem>
|
---|
| 166 | </varlistentry>
|
---|
| 167 |
|
---|
| 168 | <varlistentry os="bg5">
|
---|
| 169 | <term><parameter>--enable-threads=posix</parameter></term>
|
---|
| 170 | <listitem>
|
---|
| 171 | <para>This enables C++ exception handling for multi-threaded code.</para>
|
---|
| 172 | </listitem>
|
---|
| 173 | </varlistentry>
|
---|
| 174 |
|
---|
| 175 | </variablelist>
|
---|
| 176 |
|
---|
| 177 | <para os="bh">Continue with compiling the package:</para>
|
---|
| 178 |
|
---|
[d258427] | 179 | <screen os="bi"><userinput>make</userinput></screen>
|
---|
[43f755b] | 180 |
|
---|
| 181 | <para os="bj">Install the package:</para>
|
---|
| 182 |
|
---|
| 183 | <screen os="bk"><userinput>make install</userinput></screen>
|
---|
| 184 |
|
---|
| 185 | </sect2>
|
---|
| 186 |
|
---|
| 187 | <sect2 role="content">
|
---|
| 188 | <title/>
|
---|
| 189 |
|
---|
| 190 | <para>Details on this package are located in <xref
|
---|
| 191 | linkend="contents-gcc" role="."/></para>
|
---|
| 192 |
|
---|
| 193 | </sect2>
|
---|
| 194 |
|
---|
| 195 | </sect1>
|
---|