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