From 79524a0c69fd6f6f1fa86086b86d52328af17750 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Tue, 9 Jun 2020 23:10:16 +0000 Subject: Text updates for cross2 Chapter 5 git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11914 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter05/toolchaintechnotes.xml | 54 +++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'chapter05/toolchaintechnotes.xml') diff --git a/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml index 376337662..9e582e345 100644 --- a/chapter05/toolchaintechnotes.xml +++ b/chapter05/toolchaintechnotes.xml @@ -16,13 +16,14 @@ clearer after performing an actual build. This section can be referred to at any time during the process. - The overall goal of is to - produce a temporary area that contains a known-good set of tools that can be - isolated from the host system. By using chroot, the - commands in the remaining chapters will be contained within that environment, - ensuring a clean, trouble-free build of the target LFS system. The build - process has been designed to minimize the risks for new readers and to provide - the most educational value at the same time. + The overall goal of this chapter and is to produce a temporary area that + contains a known-good set of tools that can be isolated from the host system. + By using chroot, the commands in the remaining chapters + will be contained within that environment, ensuring a clean, trouble-free + build of the target LFS system. The build process has been designed to + minimize the risks for new readers and to provide the most educational value + at the same time. The build process is based on the process of cross-compilation. Cross-compilation is normally used @@ -143,7 +144,7 @@ appearing, that proved insufficient. The word triplet remained. A simple way to determine your machine triplet is to run the config.guess - script that comes with the source for many packages. Unpack the Binutils + script that comes with the source for many packages. Unpack the binutils sources and run the script: ./config.guess and note the output. For example, for a 32-bit Intel processor the output will be i686-pc-linux-gnu. On a 64-bit @@ -151,7 +152,7 @@ Also be aware of the name of the platform's dynamic linker, often referred to as the dynamic loader (not to be confused with the standard - linker ld that is part of Binutils). The dynamic linker + linker ld that is part of binutils). The dynamic linker provided by Glibc finds and loads the shared libraries needed by a program, prepares the program to run, and then runs it. The name of the dynamic linker for a 32-bit Intel machine will be In order to fake a cross compilation, the name of the host triplet is slightly adjusted by changing the "vendor" field in the LFS_TGT variable. We also use the - --with-sysroot when building the cross linker and - cross compiler, to tell them where to find the needed host files. This - ensures none of the other programs built in --with-sysroot option when building the cross linker and + cross compiler to tell them where to find the needed host files. This + ensures that none of the other programs built in can link to libraries on the build machine. Only two stages are mandatory, and one more for tests: @@ -215,7 +216,7 @@ internal library is named libgcc, and must be linked to the glibc library to be fully functional! Furthermore, the standard library for C++ (libstdc++) also needs being linked to glibc. The solution - to this chicken and egg problem is to first build a degraded cc1+libgcc, + to this chicken and egg problem is to first build a degraded cc1 based libgcc, lacking some fuctionalities such as threads and exception handling, then build glibc using this degraded compiler (glibc itself is not degraded), then build libstdc++. But this last library will lack the @@ -225,8 +226,8 @@ paragraph is that cc1 is unable to build a fully functional libstdc++, but this is the only compiler available for building the C/C++ libraries during stage 2! Of course, the compiler built during stage 2, cc-lfs, - would be able to build those libraries, but (i) the build system of - gcc does not know that it is usable on pc, and (ii) using it on pc + would be able to build those libraries, but (1) the build system of + gcc does not know that it is usable on pc, and (2) using it on pc would be at risk of linking to the pc libraries, since cc-lfs is a native compiler. So we have to build libstdc++ later, in chroot. @@ -306,17 +307,18 @@ checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld - As said above, the standard C++ library is compiled next, followed - by all the programs that need themselves to be built. The install step - uses the DESTDIR variable to have the programs land into - the LFS filesystem. - - Then the native lfs compiler is built. First Binutils Pass 2, with - the same DESTDIR install as the other programs, then the - second pass of GCC, omitting libstdc++ and other non-important libraries. - Due to some weird logic in GCC's configure script, - CC_FOR_TARGET ends up as cc when host - is the same as target, but is different from build. This is why + As said above, the standard C++ library is compiled next, followed in + Chapter 6 by all the programs that need themselves to be built. The install + step of libstdc++ uses the DESTDIR variable to have the + programs land into the LFS filesystem. + + In Chapter 7 the native lfs compiler is built. First binutils-pass2, + with the same DESTDIR install as the other programs is + built, and then the second pass of GCC is constructed, omitting libstdc++ + and other non-important libraries. Due to some weird logic in GCC's + configure script, CC_FOR_TARGET ends up as + cc when the host is the same as the target, but is + different from the build system. This is why CC_FOR_TARGET=$LFS_TGT-gcc is put explicitely into the configure options. -- cgit v1.2.3-54-g00ecf