[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
[9652249] | 6 | <sect1 id="ch-tools-binutils-pass1" role="wrap">
|
---|
[673b0d8] | 7 | <title>Binutils-&binutils-version; - Pass 1</title>
|
---|
| 8 | <?dbhtml filename="binutils-pass1.html"?>
|
---|
[bc82645e] | 9 |
|
---|
[673b0d8] | 10 | <indexterm zone="ch-tools-binutils-pass1">
|
---|
| 11 | <primary sortas="a-Binutils">Binutils</primary>
|
---|
| 12 | <secondary>tools, pass 1</secondary></indexterm>
|
---|
[bc82645e] | 13 |
|
---|
[9652249] | 14 | <sect2 role="package"><title/>
|
---|
| 15 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
|
---|
[673b0d8] | 16 |
|
---|
[9652249] | 17 | <segmentedlist>
|
---|
| 18 | <segtitle>&buildtime;</segtitle>
|
---|
| 19 | <segtitle>&diskspace;</segtitle>
|
---|
| 20 | <seglistitem><seg>1.0 SBU</seg><seg>194 MB</seg></seglistitem>
|
---|
| 21 | </segmentedlist>
|
---|
[673b0d8] | 22 |
|
---|
[9652249] | 23 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/>
|
---|
[73aedd1d] | 24 |
|
---|
[9652249] | 25 | </sect2>
|
---|
[73aedd1d] | 26 |
|
---|
[9652249] | 27 | <sect2 role="installation">
|
---|
[73aedd1d] | 28 | <title>Installation of Binutils</title>
|
---|
| 29 |
|
---|
[69993f4] | 30 | <para>It is important that Binutils be the first package compiled
|
---|
| 31 | because both Glibc and GCC perform various tests on the available
|
---|
| 32 | linker and assembler to determine which of their own features to
|
---|
| 33 | enable.</para>
|
---|
[73aedd1d] | 34 |
|
---|
[6e41459] | 35 | <para>This package is known to have issues when its default
|
---|
[574b0ea] | 36 | optimization flags (including the <parameter>-march</parameter> and
|
---|
[24a08b9] | 37 | <parameter>-mcpu</parameter> options) are changed. If any environment
|
---|
| 38 | variables that override default optimizations have been defined, such
|
---|
| 39 | as <emphasis>CFLAGS</emphasis> and <emphasis>CXXFLAGS</emphasis>,
|
---|
| 40 | unset them when building Binutils.</para>
|
---|
[73aedd1d] | 41 |
|
---|
| 42 | <para>The Binutils documentation recommends building Binutils outside of the
|
---|
| 43 | source directory in a dedicated build directory:</para>
|
---|
| 44 |
|
---|
| 45 | <screen><userinput>mkdir ../binutils-build
|
---|
| 46 | cd ../binutils-build</userinput></screen>
|
---|
| 47 |
|
---|
[6e41459] | 48 | <note><para>In order for the SBU values listed in the rest of the book
|
---|
| 49 | to be of any use, measure the time it takes to build this package from
|
---|
| 50 | the configuration, up to and including the first install. To achieve
|
---|
| 51 | this easily, wrap the four commands in a <command>time</command>
|
---|
| 52 | command like this: <userinput>time { ./configure ... && ...
|
---|
| 53 | && ... && make install; }</userinput>.</para></note>
|
---|
[73aedd1d] | 54 |
|
---|
| 55 | <para>Now prepare Binutils for compilation:</para>
|
---|
| 56 |
|
---|
[73734b6] | 57 | <screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools \
|
---|
[00cc7ce] | 58 | --disable-nls</userinput></screen>
|
---|
[73aedd1d] | 59 |
|
---|
| 60 | <para>The meaning of the configure options:</para>
|
---|
| 61 |
|
---|
[9652249] | 62 | <variablelist>
|
---|
| 63 | <varlistentry>
|
---|
[574b0ea] | 64 | <term><parameter>--prefix=/tools</parameter></term>
|
---|
[9652249] | 65 | <listitem><para>This tells the configure script to prepare to install the Binutils
|
---|
[574b0ea] | 66 | programs in the <filename class="directory">/tools</filename> directory.</para></listitem>
|
---|
[9652249] | 67 | </varlistentry>
|
---|
| 68 |
|
---|
| 69 | <varlistentry>
|
---|
[574b0ea] | 70 | <term><parameter>--disable-nls</parameter></term>
|
---|
[6e41459] | 71 | <listitem><para>This disables internationalization. This is not needed
|
---|
| 72 | for the static programs, and nls can cause problems when linking
|
---|
| 73 | statically.</para></listitem>
|
---|
[9652249] | 74 | </varlistentry>
|
---|
| 75 | </variablelist>
|
---|
[73aedd1d] | 76 |
|
---|
| 77 | <para>Continue with compiling the package:</para>
|
---|
| 78 |
|
---|
| 79 | <screen><userinput>make configure-host
|
---|
| 80 | make LDFLAGS="-all-static"</userinput></screen>
|
---|
| 81 |
|
---|
[5763f675] | 82 | <para>The meaning of the make parameters:</para>
|
---|
[73aedd1d] | 83 |
|
---|
[9652249] | 84 | <variablelist>
|
---|
| 85 | <varlistentry>
|
---|
[574b0ea] | 86 | <term><parameter>configure-host</parameter></term>
|
---|
[6e41459] | 87 | <listitem><para>This forces all subdirectories to be configured
|
---|
| 88 | immediately. A statically-linked build will fail without it. Use this
|
---|
| 89 | option to work around the problem:</para></listitem>
|
---|
[9652249] | 90 | </varlistentry>
|
---|
| 91 |
|
---|
| 92 | <varlistentry>
|
---|
[574b0ea] | 93 | <term><parameter>LDFLAGS="-all-static"</parameter></term>
|
---|
[6e41459] | 94 | <listitem><para>This tells the linker that all Binutils programs
|
---|
| 95 | should be linked statically. However, strictly speaking,
|
---|
| 96 | <parameter>"-all-static"</parameter> is passed to the
|
---|
| 97 | <command>libtool</command> program, which then passes
|
---|
[574b0ea] | 98 | <parameter>"-static"</parameter> to the linker.</para></listitem>
|
---|
[9652249] | 99 | </varlistentry>
|
---|
| 100 | </variablelist>
|
---|
[73aedd1d] | 101 |
|
---|
[6e41459] | 102 | <para>Compilation is now complete. Ordinarily we would now run the
|
---|
| 103 | test suite, but at this early stage the test suite framework (Tcl,
|
---|
| 104 | Expect, and DejaGNU) is not yet in place. The benefits of running the
|
---|
[69993f4] | 105 | tests at this point are minimal since the programs from this
|
---|
[6e41459] | 106 | first pass will soon be replaced by those from the second.</para>
|
---|
[443cace] | 107 |
|
---|
[6e41459] | 108 | <para>Install the package:</para>
|
---|
[73aedd1d] | 109 |
|
---|
| 110 | <screen><userinput>make install</userinput></screen>
|
---|
| 111 |
|
---|
[6e41459] | 112 | <para>Next, prepare the linker for the <quote>Adjusting</quote> phase
|
---|
| 113 | later on:</para>
|
---|
[73aedd1d] | 114 |
|
---|
| 115 | <screen><userinput>make -C ld clean
|
---|
| 116 | make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib</userinput></screen>
|
---|
| 117 |
|
---|
[5763f675] | 118 | <para>The meaning of the make parameters:</para>
|
---|
[73aedd1d] | 119 |
|
---|
[9652249] | 120 | <variablelist>
|
---|
| 121 | <varlistentry>
|
---|
[574b0ea] | 122 | <term><parameter>-C ld clean</parameter></term>
|
---|
[6e41459] | 123 | <listitem><para>This tells the make program to remove all compiled
|
---|
| 124 | files in the <filename class="directory">ld</filename>
|
---|
| 125 | subdirectory.</para></listitem>
|
---|
[9652249] | 126 | </varlistentry>
|
---|
| 127 |
|
---|
| 128 | <varlistentry>
|
---|
[574b0ea] | 129 | <term><parameter>-C ld LDFLAGS="-all-static"
|
---|
| 130 | LIB_PATH=/tools/lib</parameter></term>
|
---|
[9652249] | 131 | <listitem><para>This option rebuilds everything in the
|
---|
[ede9b9b] | 132 | <filename class="directory">ld</filename> subdirectory. Specifying the LIB_PATH
|
---|
[6e41459] | 133 | Makefile variable on the command line allows us to override the default value
|
---|
[69993f4] | 134 | and point it to the temporary tools location. The value of this variable
|
---|
[6e41459] | 135 | specifies the linker's default library search path. This preparation
|
---|
| 136 | is used later in the chapter.</para></listitem>
|
---|
[9652249] | 137 | </varlistentry>
|
---|
| 138 | </variablelist>
|
---|
[73aedd1d] | 139 |
|
---|
[0cb7f8b] | 140 | <warning><para><emphasis>Do not</emphasis> remove the Binutils
|
---|
| 141 | build and source directories yet. These will be needed again in their
|
---|
[6e41459] | 142 | current state later in this chapter.</para></warning>
|
---|
[73aedd1d] | 143 |
|
---|
| 144 | </sect2>
|
---|
[bc82645e] | 145 |
|
---|
[9652249] | 146 | <sect2 role="content"><title/>
|
---|
[69993f4] | 147 | <para>Details on this package are located in <xref linkend="contents-binutils"/>.</para>
|
---|
[0868461] | 148 | </sect2>
|
---|
[5888299] | 149 |
|
---|
[bc82645e] | 150 | </sect1>
|
---|
[6e41459] | 151 |
|
---|