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