commit:     d245318d8912a6fef051fe1bdfbee626af72a742
Author:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
AuthorDate: Mon Dec 26 00:01:52 2016 +0000
Commit:     Aric Belsito <lluixhi <AT> gmail <DOT> com>
CommitDate: Mon Dec 26 00:03:31 2016 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=d245318d

eclass: Synchronize toolchain.eclass with upstream.

musl supports __cxa_atexit, and --enable-__cxa_atexit is passed by default, but
it appears that upstream has a convention of including this in the
toolchain.eclass

 eclass/toolchain.eclass | 143 +++++++++++++++++++++++++++++++-----------------
 1 file changed, 94 insertions(+), 49 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 1192f62..a6034d3 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -131,7 +131,7 @@ else
        LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
 fi
 
-IUSE="multislot regression-test vanilla"
+IUSE="regression-test vanilla"
 IUSE_DEF=( nls nptl )
 
 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
@@ -152,9 +152,9 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
        # versions which we dropped.  Since graphite was also experimental in
        # the older versions, we don't want to bother supporting it.  #448024
        tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
-       tc_version_is_at_least 4.9 && IUSE+=" cilk"
-       tc_version_is_at_least 5.0 && IUSE+=" jit pch"
-       tc_version_is_at_least 6.0 && IUSE+=" pie +ssp"
+       tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv"
+       tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
+       tc_version_is_at_least 6.0 && IUSE+=" pie ssp +pch"
 fi
 
 IUSE+=" ${IUSE_DEF[*]/#/+}"
@@ -627,20 +627,47 @@ do_gcc_PIE_patches() {
 # configure to build with the hardened GCC specs as the default
 make_gcc_hard() {
 
-       # Gcc >= 6.X we don't need to sed in Makefile
-       # It have configurations options to turn pie/ssp on as default
+       local gcc_hard_flags=""
+       # Gcc >= 6.X we can use configuration options to turn pie/ssp on as 
default
        if tc_version_is_at_least 6.0 ; then
-               if use hardened ; then
-                       # rebrand to make bug reports easier
-                       
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
-               fi
                if use pie ; then
                        einfo "Updating gcc to use automatic PIE building ..."
                fi
                if use ssp ; then
                        einfo "Updating gcc to use automatic SSP building ..."
                fi
-               return 1
+               if use hardened ; then
+                       # Will add some optimizations by default.
+                       gcc_hard_flags+=" -DEXTRA_OPTIONS"
+                       # rebrand to make bug reports easier
+                       
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+               fi
+       else
+               if use hardened ; then
+                       # rebrand to make bug reports easier
+                       
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+                       if hardened_gcc_works ; then
+                               einfo "Updating gcc to use automatic PIE + SSP 
building ..."
+                               gcc_hard_flags+=" -DEFAULT_PIE_SSP"
+                       elif hardened_gcc_works pie ; then
+                               einfo "Updating gcc to use automatic PIE 
building ..."
+                               ewarn "SSP has not been enabled by default"
+                               gcc_hard_flags+=" -DEFAULT_PIE"
+                       elif hardened_gcc_works ssp ; then
+                               einfo "Updating gcc to use automatic SSP 
building ..."
+                               ewarn "PIE has not been enabled by default"
+                               gcc_hard_flags+=" -DEFAULT_SSP"
+                       else
+                               # do nothing if hardened isn't supported, but 
don't die either
+                               ewarn "hardened is not supported for this arch 
in this gcc version"
+                               return 0
+                       fi
+               else
+                       if hardened_gcc_works ssp ; then
+                               einfo "Updating gcc to use automatic SSP 
building ..."
+                               gcc_hard_flags+=" -DEFAULT_SSP"
+                       fi
+               fi
        fi
 
        # we want to be able to control the pie patch logic via something other
@@ -651,36 +678,8 @@ make_gcc_hard() {
        # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
        if tc_version_is_at_least 4.7 ; then
                sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
-                        -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) 
|' \
-                        -i "${S}"/gcc/Makefile.in
-       fi
-
-       # defaults to enable for all toolchains
-       local gcc_hard_flags=""
-       if use hardened ; then
-               if hardened_gcc_works ; then
-                       einfo "Updating gcc to use automatic PIE + SSP building 
..."
-                       gcc_hard_flags+=" -DEFAULT_PIE_SSP"
-               elif hardened_gcc_works pie ; then
-                       einfo "Updating gcc to use automatic PIE building ..."
-                       ewarn "SSP has not been enabled by default"
-                       gcc_hard_flags+=" -DEFAULT_PIE"
-               elif hardened_gcc_works ssp ; then
-                       einfo "Updating gcc to use automatic SSP building ..."
-                       ewarn "PIE has not been enabled by default"
-                       gcc_hard_flags+=" -DEFAULT_SSP"
-               else
-                       # do nothing if hardened isn't supported, but don't die 
either
-                       ewarn "hardened is not supported for this arch in this 
gcc version"
-                       return 0
-               fi
-               # rebrand to make bug reports easier
-               BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo 
Hardened}
-       else
-               if hardened_gcc_works ssp ; then
-                       einfo "Updating gcc to use automatic SSP building ..."
-                       gcc_hard_flags+=" -DEFAULT_SSP"
-               fi
+                       -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' 
\
+                       -i "${S}"/gcc/Makefile.in
        fi
 
        sed -i \
@@ -917,7 +916,7 @@ toolchain_src_configure() {
        fi
 
        # Support to disable pch when building libstdcxx
-       if tc_version_is_at_least 5.0 && ! use pch ; then
+       if tc_version_is_at_least 6.0 && ! use pch ; then
                confgcc+=( --disable-libstdcxx-pch )
        fi
 
@@ -1022,6 +1021,9 @@ toolchain_src_configure() {
        *-elf|*-eabi)
                confgcc+=( --with-newlib )
                ;;
+       *-musl*)
+               confgcc+=( --enable-__cxa_atexit )
+               ;;
        *-gnu*)
                confgcc+=(
                        --enable-__cxa_atexit
@@ -1187,6 +1189,17 @@ toolchain_src_configure() {
                confgcc+=( $(use_enable cilk libcilkrts) )
        fi
 
+       if in_iuse mpx ; then
+               confgcc+=( $(use_enable mpx libmpx) )
+       fi
+
+       if in_iuse vtv ; then
+               confgcc+=(
+                       $(use_enable vtv vtable-verify)
+                       $(use_enable vtv libvtv)
+               )
+       fi
+
        # newer gcc's come with libquadmath, but only fortran uses
        # it, so auto punt it when we don't care
        if tc_version_is_at_least 4.6 && ! is_fortran ; then
@@ -1756,13 +1769,49 @@ toolchain_src_install() {
        if ! is_crosscompile ; then
                insinto "${DATAPATH}"
                newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la 
fixlafiles.awk || die
-               find "${D}/${LIBPATH}" -name libstdc++.la -type f -delete
-               find "${D}/${LIBPATH}" -name 'lib*san.la' -type f -delete 
#487550 #546700
                exeinto "${DATAPATH}"
                doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
                doexe "${GCC_FILESDIR}"/c{89,99} || die
        fi
 
+       # libstdc++.la: Delete as it doesn't add anything useful: g++ itself
+       # handles linkage correctly in the dynamic & static case.  It also just
+       # causes us pain: any C++ progs/libs linking with libtool will gain a
+       # reference to the full libstdc++.la file which is gcc version specific.
+       # libstdc++fs.la: It doesn't link against anything useful.
+       # libsupc++.la: This has no dependencies.
+       # libcc1.la: There is no static library, only dynamic.
+       # libcc1plugin.la: Same as above, and it's loaded via dlopen.
+       # libgomp.la: gcc itself handles linkage (libgomp.spec).
+       # libgomp-plugin-*.la: Same as above, and it's an internal plugin only
+       # loaded via dlopen.
+       # libgfortran.la: gfortran itself handles linkage correctly in the
+       # dynamic & static case (libgfortran.spec). #573302
+       # libgfortranbegin.la: Same as above, and it's an internal lib.
+       # libmpx.la: gcc itself handles linkage correctly (libmpx.spec).
+       # libmpxwrappers.la: See above.
+       # libitm.la: gcc itself handles linkage correctly (libitm.spec).
+       # libvtv.la: gcc itself handles linkage correctly.
+       # lib*san.la: Sanitizer linkage is handled internally by gcc, and they
+       # do not support static linking. #487550 #546700
+       find "${D}/${LIBPATH}" \
+               '(' \
+                       -name libstdc++.la -o \
+                       -name libstdc++fs.la -o \
+                       -name libsupc++.la -o \
+                       -name libcc1.la -o \
+                       -name libcc1plugin.la -o \
+                       -name 'libgomp.la' -o \
+                       -name 'libgomp-plugin-*.la' -o \
+                       -name libgfortran.la -o \
+                       -name libgfortranbegin.la -o \
+                       -name libmpx.la -o \
+                       -name libmpxwrappers.la -o \
+                       -name libitm.la -o \
+                       -name libvtv.la -o \
+                       -name 'lib*san.la' \
+               ')' -type f -delete
+
        # Use gid of 0 because some stupid ports don't have
        # the group 'root' set to gid 0.  Send to /dev/null
        # for people who are testing as non-root.
@@ -2122,10 +2171,6 @@ should_we_gcc_config() {
 
        local curr_branch_ver=$(get_version_component_range 1-2 
${curr_config_ver})
 
-       # If we're using multislot, just run gcc-config if we're installing
-       # to the same profile as the current one.
-       use multislot && return $([[ ${curr_config_ver} == ${GCC_CONFIG_VER} ]])
-
        if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
                return 0
        else

Reply via email to