From 797ada6224c18798fcaaa48d54aabe824d51ea7b Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Mon, 25 Mar 2019 09:03:00 +0000 Subject: Use GCC option -ffile-prefix-map to simplify chapter 6 Glibc instruction git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11560 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter01/changelog.xml | 10 ++++++++++ chapter06/glibc.xml | 28 +++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 932f94ee3..b5ab29713 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -43,6 +43,16 @@ appropriate for the entry or if needed the entire day's listitem. --> + + 2019-03-25 + + + [xry111] - Use -ffile-prefix-map instead of -isystem and + symlinks in the Glibc build to simplify the instruction. + + + + 2019-03-13 diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index 52f03219c..04a7d6f5f 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -60,31 +60,29 @@ Fix a minor security issue with glob functions: patch -Np1 -i ../&glibc-glob-patch; ---> +--> + Create a symlink for LSB compliance. Additionally, for x86_64, create a compatibility symlink required for the dynamic loader to function correctly: case $(uname -m) in - i?86) GCC_INCDIR=/usr/lib/gcc/$(uname -m)-pc-linux-gnu/&gcc-version;/include - ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 + i?86) ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 ;; - x86_64) GCC_INCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include - ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 + x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 ;; esac - + The Glibc documentation recommends building Glibc in a dedicated build directory: @@ -93,22 +91,22 @@ cd build Prepare Glibc for compilation: -CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" \ +CC="gcc -ffile-prefix-map=/tools=/usr" \ ../configure --prefix=/usr \ --disable-werror \ --enable-kernel=&min-kernel; \ --enable-stack-protector=strong \ - libc_cv_slibdir=/lib -unset GCC_INCDIR + libc_cv_slibdir=/lib The meaning of the options and new configure parameters: - CC="gcc -isystem $GCC_INCDIR -isystem /usr/include" + CC="gcc -ffile-prefix-map=/tools=/usr" - Setting the location of both gcc and system include directories - avoids introduction of invalid paths in debugging symbols. + Make GCC record any references to files in /tools in result + of the compilation as if the files resided in /usr. This avoids + introduction of invalid paths in debugging symbols. -- cgit v1.2.3-54-g00ecf