lockingglibc.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <sect1 id="ch05-locking-glibc">
  2. <title>"Locking in" Glibc</title>
  3. <?dbhtml filename="lockingglibc.html" dir="chapter05"?>
  4. <para>Now that the temporary C libraries have been installed, we want all
  5. the tools compiled in the rest of this chapter to be linked against these
  6. libraries. To accomplish this, we need to adjust the linker's scripts and the
  7. compiler's specs file.</para>
  8. <para>First install the adjusted linker scripts by running the following from
  9. within the <filename class="directory">binutils-build</filename>
  10. directory:</para>
  11. <para><screen><userinput>make -C ld install-data-local</userinput></screen></para>
  12. <para>These scripts were adjusted a little while back, at the end of the first
  13. pass of Binutils, and contain no mention of <filename>/lib</filename>,
  14. <filename>/usr/lib</filename> or <filename>/usr/local/lib</filename>.
  15. From this point onwards everything will link <emphasis>only</emphasis>
  16. against the libraries in <filename>/stage1/lib</filename>.</para>
  17. <para>You can now remove Binutils' build and source directories.</para>
  18. <para>The other thing to do is to amend our GCC specs file so that it points
  19. to the new dynamic linker. A simple sed will accomplish this:</para>
  20. <para><screen><userinput>SPECFILE=/stage1/lib/gcc-lib/*/*/specs
  21. sed -e 's@/lib/ld.so.1@/stage1/lib/ld.so.1@g' \
  22. &nbsp;&nbsp;&nbsp;&nbsp;-e 's@/lib/ld-linux.so.2@/stage1/lib/ld-linux.so.2@g' \
  23. &nbsp;&nbsp;&nbsp;&nbsp;$SPECFILE > tempspecfile
  24. mv tempspecfile $SPECFILE
  25. unset SPECFILE</userinput></screen></para>
  26. <para>We recommend that you cut-and-paste the above rather than try and type
  27. it all in. Or you can edit the specs file by hand if you want to: just replace
  28. "/lib/ld-linux.so.2" with "/stage1/lib/ld-linux.so.2".</para>
  29. <para>This completes the installation of the self-contained toolchain, which
  30. can now be used to build the rest of the temporary tools.</para>
  31. </sect1>