binutils-pass1.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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-pass1" role="wrap">
  8. <?dbhtml filename="binutils-pass1.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 1</title>
  15. <indexterm zone="ch-tools-binutils-pass1">
  16. <primary sortas="a-Binutils">Binutils</primary>
  17. <secondary>tools, pass 1</secondary>
  18. </indexterm>
  19. <sect2 role="package">
  20. <title/>
  21. <xi:include xmlns:xi="http://www.w3.org/2003/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-ch5p1-sbu;</seg>
  29. <seg>&binutils-ch5p1-du;</seg>
  30. </seglistitem>
  31. </segmentedlist>
  32. </sect2>
  33. <sect2 role="installation">
  34. <title>Installation of Binutils</title>
  35. <para>It is important that Binutils be the first package compiled
  36. because both Glibc and GCC perform various tests on the available
  37. linker and assembler to determine which of their own features to
  38. enable.</para>
  39. <para>The Binutils documentation recommends building Binutils outside of the
  40. source directory in a dedicated build directory:</para>
  41. <screen><userinput remap="pre">mkdir -v ../binutils-build
  42. cd ../binutils-build</userinput></screen>
  43. <note>
  44. <para>In order for the SBU values listed in the rest of the book
  45. to be of any use, measure the time it takes to build this package from
  46. the configuration, up to and including the first install. To achieve
  47. this easily, wrap the three commands in a <command>time</command>
  48. command like this: <userinput>time { ./configure ... &amp;&amp; make
  49. &amp;&amp; make install; }</userinput>.</para>
  50. </note>
  51. <para>Now prepare Binutils for compilation:</para>
  52. <screen><userinput remap="configure">CC="gcc -B/usr/bin/" ../binutils-&binutils-version;/configure \
  53. --prefix=/tools --disable-nls --disable-werror</userinput></screen>
  54. <variablelist>
  55. <title>The meaning of the configure options:</title>
  56. <varlistentry>
  57. <term><envar>CC="gcc -B/usr/bin/"</envar></term>
  58. <listitem>
  59. <para>This forces <command>gcc</command> to prefer the linker from
  60. the host in <filename class="directory">/usr/bin</filename>. This
  61. is necessary on some hosts where the new <command>ld</command>
  62. built here is not compatible with the host's <command>gcc</command>.
  63. </para>
  64. </listitem>
  65. </varlistentry>
  66. <varlistentry>
  67. <term><parameter>--prefix=/tools</parameter></term>
  68. <listitem>
  69. <para>This tells the configure script to prepare to install the
  70. Binutils programs in the <filename class="directory">/tools</filename>
  71. directory.</para>
  72. </listitem>
  73. </varlistentry>
  74. <varlistentry>
  75. <term><parameter>--disable-nls</parameter></term>
  76. <listitem>
  77. <para>This disables internationalization as i18n is not needed for the
  78. temporary tools.</para>
  79. </listitem>
  80. </varlistentry>
  81. <varlistentry>
  82. <term><parameter>--disable-werror</parameter></term>
  83. <listitem>
  84. <para>This prevents the build from stopping in the event that there
  85. are warnings from the host's compiler.</para>
  86. </listitem>
  87. </varlistentry>
  88. </variablelist>
  89. <para>Continue with compiling the package:</para>
  90. <screen><userinput remap="make">make</userinput></screen>
  91. <para>Compilation is now complete. Ordinarily we would now run the
  92. test suite, but at this early stage the test suite framework (Tcl,
  93. Expect, and DejaGNU) is not yet in place. The benefits of running the
  94. tests at this point are minimal since the programs from this
  95. first pass will soon be replaced by those from the second.</para>
  96. <para>Install the package:</para>
  97. <screen><userinput remap="install">make install</userinput></screen>
  98. <para>Next, prepare the linker for the <quote>Adjusting</quote> phase
  99. later on:</para>
  100. <screen><userinput remap="adjust">make -C ld clean
  101. make -C ld LIB_PATH=/tools/lib
  102. cp -v ld/ld-new /tools/bin</userinput></screen>
  103. <variablelist>
  104. <title>The meaning of the make parameters:</title>
  105. <varlistentry>
  106. <term><parameter>-C ld clean</parameter></term>
  107. <listitem>
  108. <para>This tells the make program to remove all compiled
  109. files in the <filename class="directory">ld</filename>
  110. subdirectory.</para>
  111. </listitem>
  112. </varlistentry>
  113. <varlistentry>
  114. <term><parameter>-C ld LIB_PATH=/tools/lib</parameter></term>
  115. <listitem>
  116. <para>This option rebuilds everything in the <filename
  117. class="directory">ld</filename> subdirectory. Specifying the
  118. <envar>LIB_PATH</envar> Makefile variable on the command line
  119. allows us to override the default value and point it to the
  120. temporary tools location. The value of this variable specifies
  121. the linker's default library search path. This preparation is
  122. used later in the chapter.</para>
  123. </listitem>
  124. </varlistentry>
  125. </variablelist>
  126. </sect2>
  127. <sect2 role="content">
  128. <title/>
  129. <para>Details on this package are located in
  130. <xref linkend="contents-binutils" role="."/></para>
  131. </sect2>
  132. </sect1>