binutils-pass2.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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</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="multilib"><userinput remap="configure">CC=$LFS_TGT-gcc \
  49. AR=$LFS_TGT-ar \
  50. RANLIB=$LFS_TGT-ranlib \
  51. ../configure \
  52. --prefix=/tools \
  53. --disable-nls \
  54. --disable-werror \
  55. --with-lib-path=/tools/lib:/tools/lib32:/tools/libx32 \
  56. --with-sysroot \
  57. --enable-64-bit-bfd \
  58. --enable-multilib</userinput></screen>
  59. <variablelist>
  60. <title>The meaning of the new configure options:</title>
  61. <varlistentry>
  62. <term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
  63. <listitem>
  64. <para>Because this is really a native build of Binutils, setting these
  65. variables ensures that the build system uses the cross-compiler and
  66. associated tools instead of the ones on the host system.</para>
  67. </listitem>
  68. </varlistentry>
  69. <varlistentry arch="default">
  70. <term><parameter>--with-lib-path=/tools/lib</parameter></term>
  71. <listitem>
  72. <para>This tells the configure script to specify the library
  73. search path during the compilation of Binutils, resulting in
  74. <filename class="directory">/tools/lib</filename> being passed
  75. to the linker. This prevents the linker from searching through
  76. library directories on the host.</para>
  77. </listitem>
  78. </varlistentry>
  79. <varlistentry arch="multilib">
  80. <term><parameter>--with-lib-path=/tools/lib:...</parameter></term>
  81. <listitem>
  82. <para>This tells the configure script to specify the library
  83. search path during the compilation of Binutils, resulting in
  84. <filename class="directory">/tools/lib</filename>,
  85. <filename class="directory">/tools/lib32</filename> and
  86. <filename class="directory">/tools/libx32</filename> being passed
  87. to the linker. This prevents the linker from searching through
  88. library directories on the host.</para>
  89. </listitem>
  90. </varlistentry>
  91. <varlistentry>
  92. <term><parameter>--with-sysroot</parameter></term>
  93. <listitem>
  94. <para>The sysroot feature enables the linker to find shared objects
  95. which are required by other shared objects explicitly included on the
  96. linker's command line. Without this, some packages may not build
  97. successfully on some hosts.</para>
  98. </listitem>
  99. </varlistentry>
  100. <varlistentry arch="multilib">
  101. <term><parameter>--enable-64-bit-bfd</parameter></term>
  102. <listitem>
  103. <para>TODO</para>
  104. </listitem>
  105. </varlistentry>
  106. <varlistentry arch="multilib">
  107. <term><parameter>--enable-multilib</parameter></term>
  108. <listitem>
  109. <para>TODO</para>
  110. </listitem>
  111. </varlistentry>
  112. </variablelist>
  113. <para>Compile the package:</para>
  114. <screen><userinput remap="make">make</userinput></screen>
  115. <para>Install the package:</para>
  116. <screen><userinput remap="install">make install</userinput></screen>
  117. <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
  118. the next chapter:</para>
  119. <screen arch="default"><userinput remap="adjust">make -C ld clean
  120. make -C ld LIB_PATH=/usr/lib:/lib
  121. cp -v ld/ld-new /tools/bin</userinput></screen>
  122. <screen arch="multilib"><userinput remap="adjust">make -C ld clean
  123. make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32:/usr/libx32:/libx32
  124. cp -v ld/ld-new /tools/bin</userinput></screen>
  125. <variablelist>
  126. <title>The meaning of the make parameters:</title>
  127. <varlistentry>
  128. <term><parameter>-C ld clean</parameter></term>
  129. <listitem>
  130. <para>This tells the make program to remove all compiled
  131. files in the <filename class="directory">ld</filename>
  132. subdirectory.</para>
  133. </listitem>
  134. </varlistentry>
  135. <varlistentry>
  136. <term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
  137. <listitem>
  138. <para>This option rebuilds everything in the <filename
  139. class="directory">ld</filename> subdirectory. Specifying the
  140. <envar>LIB_PATH</envar> Makefile variable on the command line
  141. allows us to override the default value of the temporary tools
  142. and point it to the proper final path. The value of this variable
  143. specifies the linker's default library search path. This
  144. preparation is used in the next chapter.</para>
  145. </listitem>
  146. </varlistentry>
  147. </variablelist>
  148. </sect2>
  149. <sect2 role="content">
  150. <title/>
  151. <para>Details on this package are located in
  152. <xref linkend="contents-binutils" role="."/></para>
  153. </sect2>
  154. </sect1>