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