binutils-pass2.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-tools-binutils-pass2" role="wrap">
  8. <?dbhtml filename="binutils-pass2.html"?>
  9. <sect1info condition="script">
  10. <productname>binutils-pass2</productname>
  11. <productnumber>&binutils-version;</productnumber>
  12. <address>&binutils-url;</address>
  13. </sect1info>
  14. <title>Binutils-&binutils-version; - Pass 2</title>
  15. <indexterm zone="ch-tools-binutils-pass2">
  16. <primary sortas="a-Binutils">Binutils</primary>
  17. <secondary>tools, pass 2</secondary>
  18. </indexterm>
  19. <sect2 role="package">
  20. <title/>
  21. <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
  22. href="../chapter06/binutils.xml"
  23. xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
  24. <segmentedlist>
  25. <segtitle>&buildtime;</segtitle>
  26. <segtitle>&diskspace;</segtitle>
  27. <seglistitem>
  28. <seg>&binutils-ch5p2-sbu;</seg>
  29. <seg>&binutils-ch5p2-du;</seg>
  30. </seglistitem>
  31. </segmentedlist>
  32. </sect2>
  33. <sect2 role="installation">
  34. <title>Installation of Binutils</title>
  35. <para>Create a separate build directory again:</para>
  36. <screen><userinput remap="pre">mkdir -v build
  37. cd build</userinput></screen>
  38. <para>Prepare Binutils for compilation:</para>
  39. <screen arch="default"><userinput remap="configure">CC=$LFS_TGT-gcc \
  40. AR=$LFS_TGT-ar \
  41. RANLIB=$LFS_TGT-ranlib \
  42. ../configure \
  43. --prefix=/tools \
  44. --disable-nls \
  45. --disable-werror \
  46. --with-lib-path=/tools/lib \
  47. --with-sysroot</userinput></screen>
  48. <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">lpath=/tools/lib</userinput>
  49. <userinput remap="configure" arch="ml_32,ml_all">lpath="$lpath:/tools/lib32"</userinput>
  50. <userinput remap="configure" arch="ml_x32,ml_all">lpath="$lpath:/tools/libx32"</userinput>
  51. <userinput remap="configure">CC=$LFS_TGT-gcc \
  52. AR=$LFS_TGT-ar \
  53. RANLIB=$LFS_TGT-ranlib \
  54. ../configure \
  55. --prefix=/tools \
  56. --disable-nls \
  57. --disable-werror \
  58. --with-lib-path=$lpath \
  59. --with-sysroot \
  60. --enable-64-bit-bfd \
  61. --enable-multilib</userinput></screen>
  62. <variablelist>
  63. <title>The meaning of the new configure options:</title>
  64. <varlistentry>
  65. <term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
  66. <listitem>
  67. <para>Because this is really a native build of Binutils, setting these
  68. variables ensures that the build system uses the cross-compiler and
  69. associated tools instead of the ones on the host system.</para>
  70. </listitem>
  71. </varlistentry>
  72. <varlistentry arch="default">
  73. <term><parameter>--with-lib-path=/tools/lib</parameter></term>
  74. <listitem>
  75. <para>This tells the configure script to specify the library
  76. search path during the compilation of Binutils, resulting in
  77. <filename class="directory">/tools/lib</filename> being passed
  78. to the linker. This prevents the linker from searching through
  79. library directories on the host.</para>
  80. </listitem>
  81. </varlistentry>
  82. <varlistentry arch="ml_32,ml_x32,ml_all">
  83. <term><parameter>--with-lib-path=/tools/lib:...</parameter></term>
  84. <listitem>
  85. <para>This tells the configure script to specify the library
  86. search path during the compilation of Binutils, resulting in
  87. <filename class="directory">/tools/lib</filename>,
  88. <filename class="directory">/tools/lib32</filename> and
  89. <filename class="directory">/tools/libx32</filename> being passed
  90. to the linker. This prevents the linker from searching through
  91. library directories on the host.</para>
  92. </listitem>
  93. </varlistentry>
  94. <varlistentry>
  95. <term><parameter>--with-sysroot</parameter></term>
  96. <listitem>
  97. <para>This defines a default (non-existent) sysroot directory
  98. <filename class="directory">/tools/$LFS_TGT/sys-root</filename>.
  99. It is useful when looking for shared objects which are required by
  100. other shared objects explicitly included on the linker's command
  101. line. Those objects are searched into the directories listed in
  102. <filename>&lt;sysroot&gt;/etc/ld.so.conf</filename>, and failing
  103. that, into the linker search path, which is right. If this switch
  104. is not given, <filename>/etc/ld.so.conf</filename> on the host
  105. is used, that is, programs may be linked to libraries on
  106. the host, which we want to avoid.</para>
  107. </listitem>
  108. </varlistentry>
  109. <varlistentry arch="ml_32,ml_x32,ml_all">
  110. <term><parameter>--enable-64-bit-bfd</parameter></term>
  111. <listitem>
  112. <para>TODO</para>
  113. </listitem>
  114. </varlistentry>
  115. <varlistentry arch="ml_32,ml_x32,ml_all">
  116. <term><parameter>--enable-multilib</parameter></term>
  117. <listitem>
  118. <para>TODO</para>
  119. </listitem>
  120. </varlistentry>
  121. </variablelist>
  122. <para>Compile the package:</para>
  123. <screen><userinput remap="make">make</userinput></screen>
  124. <para>Install the package:</para>
  125. <screen><userinput remap="install">make install</userinput></screen>
  126. <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
  127. the next chapter:</para>
  128. <screen arch="default"><userinput remap="adjust">make -C ld clean
  129. make -C ld LIB_PATH=/usr/lib:/lib
  130. cp -v ld/ld-new /tools/bin</userinput></screen>
  131. <screen arch="ml_all"><userinput remap="adjust">make -C ld clean
  132. make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32:/usr/libx32:/libx32
  133. cp -v ld/ld-new /tools/bin</userinput></screen>
  134. <screen arch="ml_32"><userinput remap="adjust">make -C ld clean
  135. make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32
  136. cp -v ld/ld-new /tools/bin</userinput></screen>
  137. <screen arch="ml_x32"><userinput remap="adjust">make -C ld clean
  138. make -C ld LIB_PATH=/usr/lib:/lib:/usr/libx32:/libx32
  139. cp -v ld/ld-new /tools/bin</userinput></screen>
  140. <variablelist>
  141. <title>The meaning of the make parameters:</title>
  142. <varlistentry>
  143. <term><parameter>-C ld clean</parameter></term>
  144. <listitem>
  145. <para>This tells the make program to remove all compiled
  146. files in the <filename class="directory">ld</filename>
  147. subdirectory.</para>
  148. </listitem>
  149. </varlistentry>
  150. <varlistentry>
  151. <term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
  152. <listitem>
  153. <para>This option rebuilds everything in the <filename
  154. class="directory">ld</filename> subdirectory. Specifying the
  155. <envar>LIB_PATH</envar> Makefile variable on the command line
  156. allows us to override the default value of the temporary tools
  157. and point it to the proper final path. The value of this variable
  158. specifies the linker's default library search path. This
  159. preparation is used in the next chapter.</para>
  160. </listitem>
  161. </varlistentry>
  162. </variablelist>
  163. </sect2>
  164. <sect2 role="content">
  165. <title/>
  166. <para>Details on this package are located in
  167. <xref linkend="contents-binutils" role="."/></para>
  168. </sect2>
  169. </sect1>