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