2004-05-03 11:59:46 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2007-03-21 18:42:58 +00:00
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
2004-05-03 11:59:46 +01:00
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
2006-01-17 19:37:53 +00:00
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<sect1 id="ch-tools-adjusting">
|
2006-01-17 19:37:53 +00:00
|
|
|
<?dbhtml filename="adjusting.html"?>
|
|
|
|
|
|
|
|
<title>Adjusting the Toolchain</title>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2006-01-17 19:37:53 +00:00
|
|
|
<para>Now that the temporary C libraries have been installed, all
|
|
|
|
tools compiled in the rest of this chapter should be linked against
|
2008-12-05 20:46:02 +00:00
|
|
|
these libraries. In order to accomplish this, the cross-compiler's
|
|
|
|
specs file needs to be adjusted to point to the new dynamic linker
|
|
|
|
in <filename class="directory">/tools</filename>.</para>
|
|
|
|
|
|
|
|
<para>This is done by dumping the compiler's <quote>specs</quote> file to a
|
|
|
|
location where it will look for it by default.
|
|
|
|
A simple <command>sed</command> substitution then alters the
|
2008-12-03 22:46:04 +00:00
|
|
|
dynamic linker that GCC will use. The principle here is to find all references
|
|
|
|
to the dynamic linker file in <filename class="directory">/lib</filename>
|
|
|
|
or possibly <filename class="directory">/lib64</filename> if the host system
|
|
|
|
is 64-bit capable, and adjust them to point to the new location in
|
|
|
|
<filename class="directory">/tools</filename>.</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2007-03-02 23:23:14 +00:00
|
|
|
<para>For the sake of accuracy, it is recommended to use a copy-and-paste
|
|
|
|
method when issuing the following command. Be sure to visually inspect the
|
2008-12-03 22:46:04 +00:00
|
|
|
specs file to verify that it has properly adjusted all references to the
|
|
|
|
dynamic linker location. Refer to <xref
|
|
|
|
linkend="ch-tools-toolchaintechnotes" role=","/> for the default name
|
|
|
|
of the dynamic linker, if necessary.</para>
|
2006-01-17 19:37:53 +00:00
|
|
|
|
2007-03-02 23:23:14 +00:00
|
|
|
<!-- Ampersands are needed to allow copy and paste -->
|
2008-12-05 20:46:02 +00:00
|
|
|
<screen><userinput>SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
|
|
|
|
$LFS_TGT-gcc -dumpspecs | sed \
|
|
|
|
-e 's@/lib\(64\)\?/ld@/tools&@g' \
|
|
|
|
-e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
|
|
|
|
echo "New specs file is: $SPECS"
|
|
|
|
unset SPECS</userinput></screen>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2006-01-17 19:37:53 +00:00
|
|
|
<caution>
|
|
|
|
<para>At this point, it is imperative to stop and ensure that the basic
|
|
|
|
functions (compiling and linking) of the new toolchain are working as
|
|
|
|
expected. To perform a sanity check, run the following commands:</para>
|
2004-12-20 17:23:16 +00:00
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
<screen><userinput>echo 'main(){}' > dummy.c
|
2008-12-05 20:46:02 +00:00
|
|
|
$LFS_TGT-gcc -B/tools/lib dummy.c
|
2004-05-03 11:59:46 +01:00
|
|
|
readelf -l a.out | grep ': /tools'</userinput></screen>
|
|
|
|
|
2006-01-17 19:37:53 +00:00
|
|
|
<para>If everything is working correctly, there should be no errors,
|
|
|
|
and the output of the last command will be of the form:</para>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2006-01-17 19:37:53 +00:00
|
|
|
<screen><computeroutput>[Requesting program interpreter:
|
2005-01-30 12:51:22 +00:00
|
|
|
/tools/lib/ld-linux.so.2]</computeroutput></screen>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2008-12-03 22:46:04 +00:00
|
|
|
<para>Note that <filename class="directory">/tools/lib</filename>, or
|
|
|
|
<filename class="directory">/tools/lib64</filename> for 64-bit machines
|
2006-01-17 19:37:53 +00:00
|
|
|
appears as the prefix of the dynamic linker.</para>
|
|
|
|
|
|
|
|
<para>If the output is not shown as above or there was no output at all,
|
|
|
|
then something is wrong. Investigate and retrace the steps to find out
|
|
|
|
where the problem is and correct it. This issue must be resolved before
|
2008-12-05 20:46:02 +00:00
|
|
|
continuing on. Something may have gone wrong with the
|
2006-01-17 19:37:53 +00:00
|
|
|
specs file amendment above. In this case, redo the specs file amendment,
|
|
|
|
being careful to copy-and-paste the commands.</para>
|
|
|
|
|
|
|
|
<para>Once all is well, clean up the test files:</para>
|
2005-02-19 22:16:42 +00:00
|
|
|
|
2005-09-29 21:55:40 +01:00
|
|
|
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
|
2005-11-05 21:19:44 +00:00
|
|
|
|
2006-01-17 19:37:53 +00:00
|
|
|
</caution>
|
2004-05-03 11:59:46 +01:00
|
|
|
|
2008-12-05 20:46:02 +00:00
|
|
|
<note><para>Building Binutils in the next section will serve as an additional check that
|
|
|
|
the toolchain has been built properly. If Binutils fails to build, it is an
|
|
|
|
indication that something has gone wrong with the previous Binutils, GCC, or Glibc
|
|
|
|
installations.</para></note>
|
2006-07-11 03:09:51 +01:00
|
|
|
|
2004-05-03 11:59:46 +01:00
|
|
|
</sect1>
|