source: BOOK/final-system/common/adjusting.xml@ 6387d9d

clfs-3.0.0-systemd systemd
Last change on this file since 6387d9d was a23ba26, checked in by Chris Staub <chris@…>, 10 years ago

More clarification for toolchain adjustment text

  • Property mode set to 100644
File size: 2.6 KB
Line 
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
8<sect1 id="ch-system-adjusting">
9 <?dbhtml filename="adjusting.html"?>
10
11 <title>Adjusting the Toolchain</title>
12
13 <para os="a">Now we adjust GCC's specs so that they point to the new
14 dynamic linker. A <command>perl</command> command accomplishes this:</para>
15
16<screen os="c"><userinput>gcc -dumpspecs | \
17perl -p -e 's@/tools/lib/ld@/lib/ld@g;' \
18 -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' &gt; \
19 $(dirname $(gcc --print-libgcc-file-name))/specs</userinput></screen>
20
21 <para os="d">The <command>perl</command> command above makes 2
22 modifications to GCC's specs: it removes <quote>/tools</quote> from the
23 pathname to the dynamic linker, and adds <quote>/usr/lib/</quote> to the
24 startfile_prefix_spec. It is a good idea to visually inspect the
25 <filename>specs</filename> file, and compare with the output of
26 <command>gcc -dumpspecs</command>, to verify that
27 the intended changes were actually made.</para>
28
29 <para os="e">Note that <filename class="directory">/lib</filename> is now
30 the prefix of our dynamic linker.</para>
31
32 <caution>
33
34 <para os="f">It is imperative at this point to stop and ensure that
35 the basic functions (compiling and linking) of the adjusted toolchain
36 are working as expected. To do this, perform a sanity
37 check:</para>
38
39<screen os="g"><userinput>echo 'main(){}' &gt; dummy.c
40gcc dummy.c
41readelf -l a.out | grep ': /lib'</userinput></screen>
42
43 <para os="h">If everything is working correctly, there should be no errors,
44 and the output of the last command will be:</para>
45
46<screen os="i"><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
47
48 <para os="j">Note that <filename class="directory">/lib</filename> is now
49 the prefix of our dynamic linker.</para>
50
51 <para os="k">If the output does not appear as shown above or is not received
52 at all, then something is seriously wrong. Investigate and retrace the
53 steps to find out where the problem is and correct it. The most likely
54 reason is that something went wrong with the specs file amendment
55 above. Any issues will need to be resolved before continuing on with
56 the process.</para>
57
58 <para os="l">Once everything is working correctly, clean up the test
59 files:</para>
60
61<screen os="m"><userinput>rm -v dummy.c a.out</userinput></screen>
62
63 </caution>
64
65</sect1>
Note: See TracBrowser for help on using the repository browser.