From af9063d6b4a2a9ba55fea9724146a79dad9c89d9 Mon Sep 17 00:00:00 2001 From: Matthew Burgess Date: Wed, 29 Jul 2009 20:46:21 +0000 Subject: Correct and clarify toolchain explanatory notes. Fixes #2461. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9021 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter05/toolchaintechnotes.xml | 78 ++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'chapter05') diff --git a/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml index ba5a18b7d..2a7474555 100644 --- a/chapter05/toolchaintechnotes.xml +++ b/chapter05/toolchaintechnotes.xml @@ -17,13 +17,13 @@ to at any time during the process. The overall goal of is to - provide a temporary environment that can be chrooted into and from which can be - produced a clean, trouble-free build of the target LFS system in . Along the way, we separate the new system - from the host system as much as possible, and in doing so, build a - self-contained and self-hosted toolchain. It should be noted that the build - process has been designed to minimize the risks for new readers and provide - maximum educational value at the same time. + provide a temporary environment that can be chrooted into, + where a clean, trouble-free build of the target LFS system in can be produced. Along the way, we + separate the new system from the host system as much as possible, and in + doing so, build a self-contained and self-hosted toolchain. + The build process has been designed to minimize the risks for new + readers and to provide the most educational value at the same time. Before continuing, be aware of the name of the working platform, @@ -54,11 +54,13 @@ - Slightly adjusting the name of the working platform ensures that - the first build of Binutils and GCC produces a compatible cross-linker - and cross-compiler. Instead of producing binaries for another architecture, - the cross-linker and cross-compiler will produce binaries compatible with - the current hardware. + Slightly adjusting the name of the working platform, by changing the + "vendor" field target triplet by way of the + LFS_TGT variable, ensures that the first build of Binutils + and GCC produces a compatible cross-linker and cross-compiler. Instead of + producing binaries for another architecture, the cross-linker and + cross-compiler will produce binaries compatible with the current + hardware. The temporary libraries are cross-compiled. This removes all @@ -98,9 +100,8 @@ The next package installed is GCC. An example of what can be seen during its run of configure is: -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-lfs-linux-gnu/bin/as +checking what linker to use... /tools/i686-lfs-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 @@ -117,34 +118,33 @@ checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld< The next package installed is Glibc. The most important considerations for building Glibc are the compiler, binary tools, and kernel headers. The - compiler is generally not an issue since Glibc will always use the - gcc found in a PATH directory. The binary - tools and kernel headers can be a bit more complicated. Therefore, take no - risks and use the available configure switches to enforce the correct - selections. After the run of configure, check the contents - of the config.make file in the --host parameter passed to its + configure script, e.g. in our case, + i686-lfs-linux-gnu-gcc. The binary tools and kernel + headers can be a bit more complicated. Therefore, take no risks and use the + available configure switches to enforce the correct selections. After the run + of configure, check the contents of the + config.make file in the glibc-build directory for all important details. - Note the use of CC="gcc -B/tools/bin/" to control which - binary tools are used and the use of the -nostdinc - and -isystem flags to control the compiler's include + Note the use of CC="i686-lfs-gnu-gcc" to control which + binary tools are used and the use of the -nostdinc and + -isystem flags to control the compiler's include search path. These items 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, make some adjustments to ensure that - searching and linking take place only within the /tools prefix. Install an adjusted - ld, which has a hard-wired search path limited to - /tools/lib. Then amend - gcc's specs file to point to the new dynamic 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 Executable and Link Format (ELF)-shared - executable. This can be inspected by running: + After the Glibc installation, change gcc's specs file + to point to the new dynamic linker in /tools/lib. This last step is vital in ensuring + that searching and linking take place only within the /tools prefix. A hard-wired + path to a dynamic linker is embedded into every Executable and Link Format + (ELF)-shared executable. This can be inspected by running: readelf -l <name of binary> | grep interpreter. - Amending gcc's specs file ensures that every program compiled from here - through the end of this chapter will use the new dynamic linker in - /tools/lib. + Amending gcc's specs file ensures that every program + compiled from here through the end of this chapter will use the new dynamic + linker in /tools/lib. For the second pass of GCC, its sources also need to be modified to tell GCC to use the new dynamic linker. Failure to do @@ -164,8 +164,8 @@ checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld< linkend="chapter-building-system"/>, the first major package to be installed is Glibc, due to its self-sufficient nature mentioned above. Once this Glibc is installed into /usr, perform a quick changeover of the - toolchain defaults, then proceed in building the rest of the target + class="directory">/usr, we will perform a quick changeover of the + toolchain defaults, and then proceed in building the rest of the target LFS system.