From 574b0eabcc0015a1ee7c8b7098f50e2b6b0e9005 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 30 May 2004 13:41:04 +0000 Subject: Tagging corrections in chapters 5. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3730 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter05/toolchaintechnotes.xml | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'chapter05/toolchaintechnotes.xml') diff --git a/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml index d9ea431d6..666e181e2 100644 --- a/chapter05/toolchaintechnotes.xml +++ b/chapter05/toolchaintechnotes.xml @@ -27,19 +27,19 @@ words, more advanced techniques could be used to build the system. platform, often also referred to as the target triplet. For many folks the target triplet will probably be i686-pc-linux-gnu. A simple way to determine your target -triplet is to run the config.guess script that comes with +triplet is to run the config.guess script that comes with the source for many packages. Unpack the Binutils sources and run the script: ./config.guess and note the output. You'll also need to be aware of the name of your platform's dynamic linker, often also referred to as the dynamic loader, not to be confused with the standard linker -ld that is part of Binutils. The dynamic linker is provided +ld that is part of Binutils. The dynamic linker is provided by Glibc and has the job of finding and loading the shared libraries needed by a program, preparing the program to run and then running it. For most folks the -name of the dynamic linker will be ld-linux.so.2. On +name of the dynamic linker will be ld-linux.so.2. On platforms that are less prevalent, the name might be -ld.so.1 and newer 64 bit platforms might even have +ld.so.1 and newer 64 bit platforms might even have something completely different. You should be able to determine the name of your platform's dynamic linker by looking in the /lib directory on your host system. A @@ -63,7 +63,7 @@ path to ensure programs are linked only against libraries we choose. Careful manipulation of gcc's -specs file to tell the compiler which target dynamic +specs file to tell the compiler which target dynamic linker will be used. @@ -81,29 +81,29 @@ much time is wasted. /tools/$TARGET_TRIPLET/bin. In reality, the tools in one location are hard linked to the other. An important facet of the linker is its library search order. Detailed information can be obtained -from ld by passing it the --verbose +from ld by passing it the --verbose flag. For example: ld --verbose | grep SEARCH will show you the current search paths and their order. You can see what files are actually linked by ld by compiling a dummy program and -passing the --verbose switch to the linker. For example: -gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded +passing the --verbose switch to the linker. For example: +gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded will show you all the files successfully opened during the linking. The next package installed is GCC and during its run of ./configure you'll see, for example: -
checking what assembler to use... /tools/i686-pc-linux-gnu/bin/as -checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld
+
checking what assembler to use... /tools/i686-pc-linux-gnu/bin/as +checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld
This is important for the reasons mentioned above. It also demonstrates that GCC's configure script does not search the PATH directories to find which tools to use. However, during the actual operation of gcc itself, the same search paths are not necessarily used. You can find out which standard linker gcc will use by running: -gcc -print-prog-name=ld. +gcc -print-prog-name=ld. Detailed information can be obtained from gcc by passing -it the -v flag while compiling a dummy program. For -example: gcc -v dummy.c will show you detailed +it the -v flag while compiling a dummy program. For +example: gcc -v dummy.c will show you detailed information about the preprocessor, compilation and assembly stages, including gcc's include search paths and their order. @@ -117,15 +117,15 @@ switches to enforce the correct selections. After the run of config.make file in the glibc-build directory for all the important details. You'll note some interesting items like the use of -CC="gcc -B/tools/bin/" to control which binary tools are -used, and also the use of the -nostdinc and --isystem flags to control the compiler's include search +CC="gcc -B/tools/bin/" to control which binary tools are +used, and also the use of the -nostdinc and +-isystem flags to control the compiler's include search path. These items help to highlight an important aspect of the Glibc package: it is very self-sufficient in terms of its build machinery and generally does not rely on toolchain defaults. After the Glibc installation, we make some adjustments to ensure that -searching and linking take place only within our /tools +searching and linking take place only within our /tools prefix. We install an adjusted ld, which has a hard-wired search path limited to /tools/lib. Then we amend gcc's specs file to point to our new dynamic @@ -133,7 +133,7 @@ linker in /tools/lib. This last step is vital to the whole process. As mentioned above, a hard-wired path to a dynamic linker is embedded into every ELF shared executable. You can inspect this by running: -readelf -l <name of binary> | grep interpreter. +readelf -l <name of binary> | grep interpreter. By amending gcc's specs file, we are ensuring that every program compiled from here through the end of this chapter will use our new dynamic linker in /tools/lib. @@ -145,7 +145,7 @@ programs themselves having the name of the dynamic linker from the host system's would defeat our goal of getting away from the host. During the second pass of Binutils, we are able to utilize the ---with-lib-path configure switch to control +--with-lib-path configure switch to control ld's library search path. From this point onwards, the core toolchain is self-contained and self-hosted. The remainder of the packages all build against the new Glibc in -- cgit v1.2.3-54-g00ecf