binutils-pass2.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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>Apply a patch to prevent a build failure when using compiler optimizations:</para>
  36. <screen><userinput remap="pre">patch -Np1 -i ../&binutils-build-patch;</userinput></screen>
  37. <para>Create a separate build directory again:</para>
  38. <screen><userinput remap="pre">mkdir -v ../binutils-build
  39. cd ../binutils-build</userinput></screen>
  40. <para>Prepare Binutils for compilation:</para>
  41. <screen><userinput remap="configure">
  42. CC=$LFS_TGT-gcc \
  43. AR=$LFS_TGT-ar \
  44. RANLIB=$LFS_TGT-ranlib \
  45. ../binutils-&binutils-version;/configure \
  46. --prefix=/tools \
  47. --disable-nls \
  48. --with-lib-path=/tools/lib</userinput></screen>
  49. <variablelist>
  50. <title>The meaning of the new configure options:</title>
  51. <varlistentry>
  52. <term><parameter>CC="$LFS_TGT-gcc" AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
  53. <listitem>
  54. <para>Because this is really a native build of Binutils, setting these
  55. variables ensures that the build system uses the cross-compiler and
  56. associated tools instead of the ones on the host system.</para>
  57. </listitem>
  58. </varlistentry>
  59. <varlistentry>
  60. <term><parameter>--with-lib-path=/tools/lib</parameter></term>
  61. <listitem>
  62. <para>This tells the configure script to specify the library
  63. search path during the compilation of Binutils, resulting in
  64. <filename class="directory">/tools/lib</filename> being passed
  65. to the linker. This prevents the linker from searching through
  66. library directories on the host.</para>
  67. </listitem>
  68. </varlistentry>
  69. </variablelist>
  70. <para>Compile the package:</para>
  71. <screen><userinput remap="make">make</userinput></screen>
  72. <para>Install the package:</para>
  73. <screen><userinput remap="install">make install</userinput></screen>
  74. <para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
  75. the next chapter:</para>
  76. <screen><userinput remap="adjust">make -C ld clean
  77. make -C ld LIB_PATH=/usr/lib:/lib
  78. cp -v ld/ld-new /tools/bin</userinput></screen>
  79. <variablelist>
  80. <title>The meaning of the make parameters:</title>
  81. <varlistentry>
  82. <term><parameter>-C ld clean</parameter></term>
  83. <listitem>
  84. <para>This tells the make program to remove all compiled
  85. files in the <filename class="directory">ld</filename>
  86. subdirectory.</para>
  87. </listitem>
  88. </varlistentry>
  89. <varlistentry>
  90. <term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
  91. <listitem>
  92. <para>This option rebuilds everything in the <filename
  93. class="directory">ld</filename> subdirectory. Specifying the
  94. <envar>LIB_PATH</envar> Makefile variable on the command line
  95. allows us to override the default value of the temporary tools
  96. and point it to the proper final path. The value of this variable
  97. specifies the linker's default library search path. This
  98. preparation is used in the next chapter.</para>
  99. </listitem>
  100. </varlistentry>
  101. </variablelist>
  102. </sect2>
  103. <sect2 role="content">
  104. <title/>
  105. <para>Details on this package are located in
  106. <xref linkend="contents-binutils" role="."/></para>
  107. </sect2>
  108. </sect1>