commit:     4513898cf015ccb78abba9eb6ec451e754c14ad0
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Fri May 27 10:48:26 2016 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Fri May 27 10:48:26 2016 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=4513898c

scripts/bootstrap-prefix.sh: solve RHEL 6.7 bootstrap issues.

  - binutils-config and ldconfig should be called explicitly
  - lto of gcc should be disabled. ld points to the host dynamic
    loader and gcc points to the RAP one, ld cannot load the gcc
    lto plugin.

 scripts/bootstrap-prefix.sh | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 874e627..196dc73 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -149,8 +149,7 @@ configure_cflags() {
 configure_toolchain() {
        linker="sys-devel/binutils"
        local gcc_deps="dev-libs/gmp dev-libs/mpfr dev-libs/mpc"
-       local gcc_rap_deps=$(rapx "sys-kernel/linux-headers sys-libs/glibc")
-       compiler="${gcc_deps} ${gcc_rap_deps} sys-devel/gcc-config 
sys-devel/gcc"
+       compiler="${gcc_deps} sys-devel/gcc-config sys-devel/gcc"
        compiler_stage1="${gcc_deps} sys-devel/gcc-config"
        case ${CHOST} in
        *-cygwin*)
@@ -1376,10 +1375,14 @@ bootstrap_stage3() {
                        ${linker}
                )
        fi
-       LDFLAGS="${LDFLAGS} $(rapx -Wl,-rpath=${ROOT}/usr/$(get_libdir))" \
+       # binutils has the host dynamic loader(DL), while gcc will have the RAP 
one.
+       # A gcc lto plugin (new DL) will fail to work with ld (old DL).
+       # USE=-cxx disables ld.gold and plugins.
+       USE="${USE} $(rapx -cxx)" \
        emerge_pkgs --nodeps "${pkgs[@]}" || return 1
 
        if is-rap ; then
+               binutils-config 1 || return 1
                if [[ ! -x "${ROOT}"/usr/bin/perl ]]; then
                        echo "We need ${ROOT}/usr/bin/perl to merge glibc." > 
"${ROOT}"/usr/bin/perl
                        chmod +x "${ROOT}"/usr/bin/perl
@@ -1389,8 +1392,9 @@ bootstrap_stage3() {
                        mkdir -p "${ROOT}"/etc/ld.so.conf.d
                        dirname $(gcc -print-libgcc-file-name) > 
"${ROOT}"/etc/ld.so.conf.d/stage2.conf
                fi
+               emerge_pkgs --nodeps sys-kernel/linux-headers sys-libs/glibc \
+                       && "${ROOT}"/usr/sbin/ldconfig || return 1
        fi
-
        # On some hosts, gcc gets confused now when it uses the new linker,
        # see for instance bug #575480.  While we would like to hide that
        # linker, we can't since we want the compiler to pick it up.
@@ -1404,9 +1408,10 @@ bootstrap_stage3() {
        ( cd "${ROOT}"/usr/bin && test ! -e python && ln -s 
"${ROOT}"/tmp/usr/bin/python2.7 )
        # in addition, avoid collisions
        rm -Rf "${ROOT}"/tmp/usr/lib/python2.7/site-packages/clang
+       RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9])
        # try to get ourself out of the mudd, bug #575324
-       EXTRA_ECONF="--disable-compiler-version-checks" \
-       LDFLAGS="${LDFLAGS} $(rapx -Wl,--dynamic-linker=$(echo 
${ROOT}/$(get_libdir)/ld*.so.[0-9]))" \
+       EXTRA_ECONF="--disable-compiler-version-checks $(rapx --disable-lto)" \
+       LDFLAGS="${LDFLAGS} $(rapx -Wl,--dynamic-linker=${RAP_DLINKER})" \
        emerge_pkgs --nodeps ${compiler} || return 1
        is-rap && rm -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf
        ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python2.7 )

Reply via email to