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

sysvinit
Last change on this file since d4f9e43 was 9a486da, checked in by William Harrington <kb0iic@…>, 9 years ago

Add int to main since GCC 5 returns defaults to int [-Wimplicit-int]. Suppress the warning.

  • Property mode set to 100644
File size: 2.4 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 <caution>
30
31 <para os="f">It is imperative at this point to stop and ensure that
32 the basic functions (compiling and linking) of the adjusted toolchain
33 are working as expected. To do this, perform a sanity
34 check:</para>
35
36<screen os="g"><userinput>echo 'int main(){}' &gt; dummy.c
37gcc dummy.c
38readelf -l a.out | grep ': /lib'</userinput></screen>
39
40 <para os="h">If everything is working correctly, there should be no errors,
41 and the output of the last command will be:</para>
42
43<screen os="i"><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
44
45 <para os="j">Note that <filename class="directory">/lib</filename> is now
46 the prefix of our dynamic linker.</para>
47
48 <para os="k">If the output does not appear as shown above or is not received
49 at all, then something is seriously wrong. Investigate and retrace the
50 steps to find out where the problem is and correct it. The most likely
51 reason is that something went wrong with the specs file amendment
52 above. Any issues will need to be resolved before continuing on with
53 the process.</para>
54
55 <para os="l">Once everything is working correctly, clean up the test
56 files:</para>
57
58<screen os="m"><userinput>rm -v dummy.c a.out</userinput></screen>
59
60 </caution>
61
62</sect1>
Note: See TracBrowser for help on using the repository browser.