[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 |
|
---|
| 30 | <para>It is important that Binutils be the first package to get compiled,
|
---|
| 31 | because both Glibc and GCC perform various tests on the available linker and
|
---|
| 32 | assembler to determine which of their own features to enable.</para>
|
---|
| 33 |
|
---|
[ede9b9b] | 34 | <para>This package is known to behave badly when you change its default
|
---|
[574b0ea] | 35 | optimization flags (including the <parameter>-march</parameter> and
|
---|
| 36 | <parameter>-mcpu</parameter> options). Therefore, if you have defined any
|
---|
[ede9b9b] | 37 | environment variables that override default optimizations, such as CFLAGS and
|
---|
[673b0d8] | 38 | CXXFLAGS, we recommend un-setting them when building Binutils.</para>
|
---|
[73aedd1d] | 39 |
|
---|
[af133c3] | 40 | <para>The current version of Binutils in use has a bug that causes strip to
|
---|
| 41 | remove necessary information from certain library files. This patch fixes
|
---|
| 42 | the problem:</para>
|
---|
| 43 |
|
---|
| 44 | <screen><userinput>patch -Np1 -i ../binutils-&binutils-version;-fix_strip-1.patch</userinput></screen>
|
---|
| 45 |
|
---|
[73aedd1d] | 46 | <para>The Binutils documentation recommends building Binutils outside of the
|
---|
| 47 | source directory in a dedicated build directory:</para>
|
---|
| 48 |
|
---|
| 49 | <screen><userinput>mkdir ../binutils-build
|
---|
| 50 | cd ../binutils-build</userinput></screen>
|
---|
| 51 |
|
---|
| 52 | <note><para>If you want the SBU values listed in the rest of the book to be of
|
---|
[ede9b9b] | 53 | any use, you will have to measure the time it takes to build this package --
|
---|
[673b0d8] | 54 | from the configuration up to and including the first install. To achieve this
|
---|
[ede9b9b] | 55 | easily, you could wrap the four commands in a <command>time</command> command
|
---|
| 56 | like this: <userinput>time { ./configure ... && ... && ...
|
---|
| 57 | && make install; }</userinput>.</para></note>
|
---|
[73aedd1d] | 58 |
|
---|
| 59 | <para>Now prepare Binutils for compilation:</para>
|
---|
| 60 |
|
---|
[673b0d8] | 61 | <screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools --disable-nls</userinput></screen>
|
---|
[73aedd1d] | 62 |
|
---|
| 63 | <para>The meaning of the configure options:</para>
|
---|
| 64 |
|
---|
[9652249] | 65 | <variablelist>
|
---|
| 66 | <varlistentry>
|
---|
[574b0ea] | 67 | <term><parameter>--prefix=/tools</parameter></term>
|
---|
[9652249] | 68 | <listitem><para>This tells the configure script to prepare to install the Binutils
|
---|
[574b0ea] | 69 | programs in the <filename class="directory">/tools</filename> directory.</para></listitem>
|
---|
[9652249] | 70 | </varlistentry>
|
---|
| 71 |
|
---|
| 72 | <varlistentry>
|
---|
[574b0ea] | 73 | <term><parameter>--disable-nls</parameter></term>
|
---|
[9652249] | 74 | <listitem><para>This disables internationalization (a word often shortened to
|
---|
| 75 | i18n). We don't need this for our static programs and <emphasis>nls</emphasis>
|
---|
| 76 | often causes problems when linking statically.</para></listitem>
|
---|
| 77 | </varlistentry>
|
---|
| 78 | </variablelist>
|
---|
[73aedd1d] | 79 |
|
---|
| 80 | <para>Continue with compiling the package:</para>
|
---|
| 81 |
|
---|
| 82 | <screen><userinput>make configure-host
|
---|
| 83 | make LDFLAGS="-all-static"</userinput></screen>
|
---|
| 84 |
|
---|
[5763f675] | 85 | <para>The meaning of the make parameters:</para>
|
---|
[73aedd1d] | 86 |
|
---|
[9652249] | 87 | <variablelist>
|
---|
| 88 | <varlistentry>
|
---|
[574b0ea] | 89 | <term><parameter>configure-host</parameter></term>
|
---|
[9652249] | 90 | <listitem><para>This forces all the subdirectories to be configured immediately.
|
---|
| 91 | A statically linked build will fail without it. We therefore use this option to work
|
---|
| 92 | around the problem.</para></listitem>
|
---|
| 93 | </varlistentry>
|
---|
| 94 |
|
---|
| 95 | <varlistentry>
|
---|
[574b0ea] | 96 | <term><parameter>LDFLAGS="-all-static"</parameter></term>
|
---|
[9652249] | 97 | <listitem><para>This tells the linker that all the Binutils programs should be
|
---|
[574b0ea] | 98 | linked statically. However, strictly speaking, <parameter>"-all-static"</parameter>
|
---|
[9652249] | 99 | is passed to the <command>libtool</command> program, which then passes
|
---|
[574b0ea] | 100 | <parameter>"-static"</parameter> to the linker.</para></listitem>
|
---|
[9652249] | 101 | </varlistentry>
|
---|
| 102 | </variablelist>
|
---|
[73aedd1d] | 103 |
|
---|
[ede9b9b] | 104 | <para>Compilation is complete. Normally we would now run the test suite, but
|
---|
[cb983a8] | 105 | at this early stage the test suite framework (Tcl, Expect and DejaGNU) is not
|
---|
[ede9b9b] | 106 | yet in place. And there would be little point in running the tests anyhow,
|
---|
| 107 | since the programs from this first pass will soon be replaced by those from the
|
---|
| 108 | second.</para>
|
---|
[443cace] | 109 |
|
---|
[673b0d8] | 110 | <para>Now install the package:</para>
|
---|
[73aedd1d] | 111 |
|
---|
| 112 | <screen><userinput>make install</userinput></screen>
|
---|
| 113 |
|
---|
[673b0d8] | 114 | <para>Now prepare the linker for the <quote>Adjusting</quote> phase later on:</para>
|
---|
[73aedd1d] | 115 |
|
---|
| 116 | <screen><userinput>make -C ld clean
|
---|
| 117 | make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib</userinput></screen>
|
---|
| 118 |
|
---|
[5763f675] | 119 | <para>The meaning of the make parameters:</para>
|
---|
[73aedd1d] | 120 |
|
---|
[9652249] | 121 | <variablelist>
|
---|
| 122 | <varlistentry>
|
---|
[574b0ea] | 123 | <term><parameter>-C ld clean</parameter></term>
|
---|
[9652249] | 124 | <listitem><para>This tells the make program to remove all the compiled files
|
---|
| 125 | in the <filename class="directory">ld</filename> subdirectory.</para></listitem>
|
---|
| 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
|
---|
| 133 | makefile variable on the command line allows us to override the default value
|
---|
| 134 | and have it point to our temporary tools location. The value of this variable
|
---|
| 135 | specifies the linker's default library search path. You will see how this
|
---|
| 136 | preparation is used later on in the chapter.</para></listitem>
|
---|
[9652249] | 137 | </varlistentry>
|
---|
| 138 | </variablelist>
|
---|
[73aedd1d] | 139 |
|
---|
| 140 |
|
---|
[a0b689e] | 141 | <warning><para><emphasis>Do not yet remove</emphasis> the Binutils build and
|
---|
| 142 | source directories. You will need them again in their current state a bit
|
---|
| 143 | further on in this chapter.</para></warning>
|
---|
[73aedd1d] | 144 |
|
---|
| 145 |
|
---|
| 146 | </sect2>
|
---|
[bc82645e] | 147 |
|
---|
[9652249] | 148 | <sect2 role="content"><title/>
|
---|
[5888299] | 149 | <para>The details on this package are found in <xref linkend="contents-binutils"/>.</para>
|
---|
[0868461] | 150 | </sect2>
|
---|
[5888299] | 151 |
|
---|
[bc82645e] | 152 | </sect1>
|
---|