Ticket #2461: toolchain-v2.patch

File toolchain-v2.patch, 3.7 KB (added by Matthew Burgess, 15 years ago)
  • chapter05/toolchaintechnotes.xml

    old new  
    9999  seen during its run of <command>configure</command> is:</para>
    100100
    101101<screen><computeroutput>checking what assembler to use...
    102         /tools/i686-pc-linux-gnu/bin/as
    103 checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld</computeroutput></screen>
     102        /tools/i686-lfs-linux-gnu/bin/as
     103checking what linker to use... /tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
    104104
    105105  <para>This is important for the reasons mentioned above. It also demonstrates
    106106  that GCC's configure script does not search the PATH directories to find which
     
    117117
    118118  <para>The next package installed is Glibc. The most important considerations
    119119  for building Glibc are the compiler, binary tools, and kernel headers. The
    120   compiler is generally not an issue since Glibc will always use the
    121   <command>gcc</command> found in a <envar>PATH</envar> directory. The binary
     120  compiler is generally not an issue since Glibc will always use the compiler
     121  relating to the <parameter>--host</parameter> parameter passed to its
     122  configure script, e.g. <command>i686-lfs-linux-gnu-gcc</command>. The binary
    122123  tools and kernel headers can be a bit more complicated. Therefore, take no
    123124  risks and use the available configure switches to enforce the correct
    124125  selections. After the run of <command>configure</command>, check the contents
    125126  of the <filename>config.make</filename> file in the <filename
    126127  class="directory">glibc-build</filename> directory for all important details.
    127   Note the use of <parameter>CC="gcc -B/tools/bin/"</parameter> to control which
     128  Note the use of <parameter>CC="i686-lfs-gnu-gcc"</parameter> to control which
    128129  binary tools are used and the use of the <parameter>-nostdinc</parameter>
    129130  and <parameter>-isystem</parameter> flags to control the compiler's include
    130131  search path. These items highlight an important aspect of the Glibc
    131132  package&mdash;it is very self-sufficient in terms of its build machinery and
    132133  generally does not rely on toolchain defaults.</para>
    133134
    134   <para>After the Glibc installation, make some adjustments to ensure that
    135   searching and linking take place only within the <filename
    136   class="directory">/tools</filename> prefix.  Install an adjusted
    137   <command>ld</command>, which has a hard-wired search path limited to
    138   <filename class="directory">/tools/lib</filename>. Then amend
    139   <command>gcc</command>'s specs file to point to the new dynamic linker in
    140   <filename class="directory">/tools/lib</filename>. This last step is vital
    141   to the whole process. As mentioned above, a hard-wired path to a dynamic
    142   linker is embedded into every Executable and Link Format (ELF)-shared
    143   executable.  This can be inspected by running:
     135  <para>After the Glibc installation, amend <command>gcc</command>'s specs file
     136  to point to the new dynamic linker in <filename
     137  class="directory">/tools/lib</filename>.  This last step is vital in ensuring
     138  that searching and linking take place only within the <filename
     139  class="directory">/tools</filename> prefix. As mentioned above, a hard-wired
     140  path to a dynamic linker is embedded into every Executable and Link Format
     141  (ELF)-shared executable.  This can be inspected by running:
    144142  <userinput>readelf -l &lt;name of binary&gt; | grep interpreter</userinput>.
    145143  Amending gcc's specs file ensures that every program compiled from here
    146144  through the end of this chapter will use the new dynamic linker in