1 | <sect1 id="ch05-locking-glibc">
|
---|
2 | <title>"Locking in" Glibc</title>
|
---|
3 | <?dbhtml filename="lockingglibc.html" dir="chapter05"?>
|
---|
4 |
|
---|
5 | <para>Now that the temporary C libraries have been installed, we want all
|
---|
6 | the tools compiled in the rest of this chapter to be linked against these
|
---|
7 | libraries. To accomplish this, we need to adjust the linker's scripts and the
|
---|
8 | compiler's specs file.</para>
|
---|
9 |
|
---|
10 | <para>First install the adjusted linker scripts by running the following from
|
---|
11 | within the <filename class="directory">binutils-build</filename>
|
---|
12 | directory:</para>
|
---|
13 |
|
---|
14 | <para><screen><userinput>make -C ld install-data-local</userinput></screen></para>
|
---|
15 |
|
---|
16 | <para>These scripts were adjusted a little while back, at the end of the first
|
---|
17 | pass of Binutils, and contain no mention of <filename>/lib</filename>,
|
---|
18 | <filename>/usr/lib</filename> or <filename>/usr/local/lib</filename>.
|
---|
19 | From this point onwards everything will link <emphasis>only</emphasis>
|
---|
20 | against the libraries in <filename>/tools/lib</filename>.</para>
|
---|
21 |
|
---|
22 | <para>Now that the scripts are adjusted, you have to remove the Binutils
|
---|
23 | build and source directories.</para>
|
---|
24 |
|
---|
25 | <para>The next thing to do is to amend our GCC specs file so that it points
|
---|
26 | to the new dynamic linker. A simple sed will accomplish this:</para>
|
---|
27 |
|
---|
28 | <para><screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs
|
---|
29 | sed -e 's@/lib/ld.so.1@/tools/lib/ld.so.1@g' \
|
---|
30 | -e 's@/lib/ld-linux.so.2@/tools/lib/ld-linux.so.2@g' \
|
---|
31 | $SPECFILE > tempspecfile
|
---|
32 | mv tempspecfile $SPECFILE
|
---|
33 | unset SPECFILE</userinput></screen></para>
|
---|
34 |
|
---|
35 | <para>We recommend that you cut-and-paste the above rather than try and type it
|
---|
36 | all in. Or you can edit the specs file by hand if you want to: just replace
|
---|
37 | "/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2" and "/lib/ld.so.1" with
|
---|
38 | "/tools/lib/ld.so.1".</para>
|
---|
39 |
|
---|
40 | <para>Lastly, there is a possibility that some include files from the host
|
---|
41 | system have found their way into gcc's private include dir. This can happen
|
---|
42 | because of GCC's "fixincludes" process which part of the GCC build. We'll
|
---|
43 | explain more about this further on in this chapter. For now, run the
|
---|
44 | following commands to eliminate this possibility.</para>
|
---|
45 |
|
---|
46 | <para><screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen></para>
|
---|
47 |
|
---|
48 | <para>This completes the installation of the self-contained toolchain, which
|
---|
49 | can now be used to build the rest of the temporary tools.</para>
|
---|
50 |
|
---|
51 | </sect1>
|
---|
52 |
|
---|