[bf8c11f] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/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 amend the GCC specs file so that it points to the new
|
---|
| 14 | dynamic linker. A <command>perl</command> command accomplishes this:</para>
|
---|
| 15 |
|
---|
| 16 | <warning os="b">
|
---|
| 17 | <para><emphasis>Do not</emphasis> run the following command more than
|
---|
| 18 | once, it will adversely affect the outcome of software built after
|
---|
| 19 | this step.</para>
|
---|
| 20 | </warning>
|
---|
| 21 |
|
---|
| 22 | <screen os="c"><userinput>gcc -dumpspecs | \
|
---|
| 23 | perl -pi -e 's@/tools/lib/ld@/lib/ld@g;' \
|
---|
| 24 | -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' > \
|
---|
| 25 | `dirname $(gcc --print-libgcc-file-name)`/specs</userinput></screen>
|
---|
| 26 |
|
---|
| 27 | <para os="d">It is a good idea to visually inspect the specs file to verify the
|
---|
| 28 | intended change was actually made.</para>
|
---|
| 29 |
|
---|
| 30 | <para os="e">Note that <filename class="directory">/lib</filename> is now
|
---|
| 31 | the prefix of our dynamic linker.</para>
|
---|
| 32 |
|
---|
| 33 | <caution>
|
---|
| 34 |
|
---|
| 35 | <para os="f">It is imperative at this point to stop and ensure that
|
---|
| 36 | the basic functions (compiling and linking) of the adjusted toolchain
|
---|
| 37 | are working as expected. To do this, perform a sanity
|
---|
| 38 | check:</para>
|
---|
| 39 |
|
---|
| 40 | <screen os="g"><userinput>echo 'main(){}' > dummy.c
|
---|
| 41 | cc dummy.c
|
---|
| 42 | readelf -l a.out | grep ': /lib'</userinput></screen>
|
---|
| 43 |
|
---|
| 44 | <para os="h">If everything is working correctly, there should be no errors,
|
---|
| 45 | and the output of the last command will be:</para>
|
---|
| 46 |
|
---|
| 47 | <screen os="i"><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
|
---|
| 48 |
|
---|
| 49 | <para os="j">Note that <filename class="directory">/lib</filename> is now
|
---|
| 50 | the prefix of our dynamic linker.</para>
|
---|
| 51 |
|
---|
| 52 | <para os="k">If the output does not appear as shown above or is not received
|
---|
| 53 | at all, then something is seriously wrong. Investigate and retrace the
|
---|
| 54 | steps to find out where the problem is and correct it. The most likely
|
---|
| 55 | reason is that something went wrong with the specs file amendment
|
---|
| 56 | above. Any issues will need to be resolved before continuing on with
|
---|
| 57 | the process.</para>
|
---|
| 58 |
|
---|
| 59 | <para os="l">Once everything is working correctly, clean up the test
|
---|
| 60 | files:</para>
|
---|
| 61 |
|
---|
| 62 | <screen os="m"><userinput>rm dummy.c a.out</userinput></screen>
|
---|
| 63 |
|
---|
| 64 | </caution>
|
---|
| 65 |
|
---|
| 66 | </sect1>
|
---|