[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>
|
---|
| 20 | against the libraries in <filename>/stage1/lib</filename>.</para>
|
---|
[78deb7d] | 21 |
|
---|
[ab6f1859] | 22 | <para>You can now remove Binutils' build and source directories.</para>
|
---|
[66e4325] | 23 |
|
---|
[1f30432] | 24 | <para>The other thing to do is to amend our GCC specs file so that it points
|
---|
[66e4325] | 25 | to the new dynamic linker. A simple sed will accomplish this:</para>
|
---|
| 26 |
|
---|
[585ce08] | 27 | <para><screen><userinput>SPECFILE=/stage1/lib/gcc-lib/*/*/specs
|
---|
| 28 | sed -e 's@/lib/ld.so.1@/stage1/lib/ld.so.1@g' \
|
---|
| 29 | -e 's@/lib/ld-linux.so.2@/stage1/lib/ld-linux.so.2@g' \
|
---|
[1f30432] | 30 | $SPECFILE > tempspecfile
|
---|
| 31 | mv tempspecfile $SPECFILE
|
---|
[585ce08] | 32 | unset SPECFILE</userinput></screen></para>
|
---|
[bc82645e] | 33 |
|
---|
[66e4325] | 34 | <para>We recommend that you cut-and-paste the above rather than try and type
|
---|
| 35 | it all in. Or you can edit the specs file by hand if you want to: just replace
|
---|
| 36 | "/lib/ld-linux.so.2" with "/stage1/lib/ld-linux.so.2".</para>
|
---|
| 37 |
|
---|
[40b88c2] | 38 | <para>Also, because we allowed GCC's "Fixincludes" script to modify our host's
|
---|
| 39 | header files (and this was necessary because of improper use of the __thread
|
---|
| 40 | keyword in some older software), we want to get rid of those modified header
|
---|
| 41 | files, and replace them with pristine ones.</para>
|
---|
| 42 |
|
---|
| 43 | <para><screen><userinput>GCCDIR=/stage1/lib/gcc-lib/*/*
|
---|
| 44 | rm -rf $GCCDIR/include/*
|
---|
| 45 | cp $GCCDIR/install-tools/include/* $GCCDIR/include
|
---|
| 46 | cp $GCCDIR/install-tools/gsyslimits.h \
|
---|
| 47 | $GCCDIR/include/syslimits.h
|
---|
| 48 | unset GCCDIR</userinput></screen></para>
|
---|
| 49 |
|
---|
[66e4325] | 50 | <para>This completes the installation of the self-contained toolchain, which
|
---|
| 51 | can now be used to build the rest of the temporary tools.</para>
|
---|
| 52 |
|
---|
[bc82645e] | 53 | </sect1>
|
---|
| 54 |
|
---|