[bc82645e] | 1 | <sect1 id="ch05-locking-glibc">
|
---|
| 2 | <title>"Locking in" Glibc</title>
|
---|
| 3 | <?dbhtml filename="lockingglibc.html" dir="chapter05"?>
|
---|
| 4 |
|
---|
[1f30432] | 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>
|
---|
[bc82645e] | 9 |
|
---|
[1f30432] | 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>
|
---|
[2cff2cc] | 13 |
|
---|
[e91d8ce] | 14 | <para><screen><userinput>make -C ld install-data-local</userinput></screen></para>
|
---|
[bc82645e] | 15 |
|
---|
[1f30432] | 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>,
|
---|
[66e4325] | 18 | <filename>/usr/lib</filename> or <filename>/usr/local/lib</filename>.
|
---|
| 19 | From this point onwards everything will link <emphasis>only</emphasis>
|
---|
[148bb04] | 20 | against the libraries in <filename>/tools/lib</filename>.</para>
|
---|
[78deb7d] | 21 |
|
---|
[c9398bc] | 22 | <para>Now that the scripts are adjusted, you have to remove the Binutils
|
---|
| 23 | build and source directories.</para>
|
---|
[66e4325] | 24 |
|
---|
[c9398bc] | 25 | <para>The next thing to do is to amend our GCC specs file so that it points
|
---|
[66e4325] | 26 | to the new dynamic linker. A simple sed will accomplish this:</para>
|
---|
| 27 |
|
---|
[148bb04] | 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' \
|
---|
[1f30432] | 31 | $SPECFILE > tempspecfile
|
---|
| 32 | mv tempspecfile $SPECFILE
|
---|
[585ce08] | 33 | unset SPECFILE</userinput></screen></para>
|
---|
[bc82645e] | 34 |
|
---|
[7064daf] | 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>
|
---|
[66e4325] | 39 |
|
---|
[be2dd91] | 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
|
---|
[fa2e693] | 42 | because of GCC's "fixincludes" process which runs as part of the GCC build.
|
---|
| 43 | We'll explain more about this further on in this chapter. For now, run the
|
---|
[be2dd91] | 44 | following commands to eliminate this possibility.</para>
|
---|
| 45 |
|
---|
[148bb04] | 46 | <para><screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen></para>
|
---|
[40b88c2] | 47 |
|
---|
[66e4325] | 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 |
|
---|
[bc82645e] | 51 | </sect1>
|
---|
| 52 |
|
---|