From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SGfWp-0000NP-6j for garchives@archives.gentoo.org; Sat, 07 Apr 2012 23:58:47 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D523E0798; Sat, 7 Apr 2012 23:58:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id D71C3E0798 for ; Sat, 7 Apr 2012 23:58:38 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1AA3D1B4076 for ; Sat, 7 Apr 2012 23:58:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id DE110E5403 for ; Sat, 7 Apr 2012 23:58:35 +0000 (UTC) From: "Magnus Granberg" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Magnus Granberg" Message-ID: <1333843100.e55e38c40d8f9d8b44f9335a4f1c1e0016227534.zorry@gentoo> Subject: [gentoo-commits] proj/hardened-dev:testing commit in: eclass/ X-VCS-Repository: proj/hardened-dev X-VCS-Files: eclass/toolchain.eclass X-VCS-Directories: eclass/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: e55e38c40d8f9d8b44f9335a4f1c1e0016227534 X-VCS-Branch: testing Date: Sat, 7 Apr 2012 23:58:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 37263034-5062-415e-a928-4ee5507b599a X-Archives-Hash: 28e24ae93092158a029bcdc1d3392596 commit: e55e38c40d8f9d8b44f9335a4f1c1e0016227534 Author: Magnus Granberg gentoo org> AuthorDate: Sat Apr 7 23:58:20 2012 +0000 Commit: Magnus Granberg gentoo org> CommitDate: Sat Apr 7 23:58:20 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/hardened-dev.= git;a=3Dcommit;h=3De55e38c4 remove alot of =3Ddev-libs/gmp-4.3.2 >=3Ddev-libs/mpfr-2.4.2" - if tc_version_is_at_least 4.3 ; then - RDEPEND+=3D" ${GMP_MPFR_DEPS}" - elif in_iuse fortran ; then - RDEPEND+=3D" fortran? ( ${GMP_MPFR_DEPS} )" - fi - if tc_version_is_at_least 4.5 ; then - RDEPEND+=3D" >=3Ddev-libs/mpc-0.8.1" - fi - in_iuse lto && RDEPEND+=3D" lto? ( || ( >=3Ddev-libs/elfutils-0.143 dev= -libs/libelf ) )" -fi +RDEPEND+=3D" virtual/libiconv" +RDEPEND+=3D" >=3Ddev-libs/mpc-0.8.1" +GMP_MPFR_DEPS=3D">=3Ddev-libs/gmp-4.3.2 >=3Ddev-libs/mpfr-2.4.2" +RDEPEND+=3D" ${GMP_MPFR_DEPS}" +in_iuse lto && RDEPEND+=3D" lto? ( || ( >=3Ddev-libs/elfutils-0.143 dev-= libs/libelf ) )" if in_iuse graphite ; then RDEPEND+=3D" graphite? ( @@ -167,9 +144,9 @@ if in_iuse gcj ; then x11-proto/xproto x11-proto/xextproto =3Dx11-libs/gtk+-2*" - tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=3D" x11-libs/pango" + GCJ_GTK_DEPS+=3D" x11-libs/pango" GCJ_DEPS=3D">=3Dmedia-libs/libart_lgpl-2.1" - tc_version_is_at_least 4.2 && GCJ_DEPS+=3D" app-arch/zip app-arch/unzip= " + GCJ_DEPS+=3D" app-arch/zip app-arch/unzip" DEPEND+=3D" gcj? ( gtk? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )" fi =20 @@ -301,14 +278,8 @@ get_gcc_src_uri() { =20 [[ -n ${D_VER} ]] && GCC_SRC_URI+=3D" d? ( mirror://sourceforge/dgcc/gd= c-${D_VER}-src.tar.bz2 )" =20 - # >=3D gcc-4.3 uses ecj.jar and we only add gcj as a use flag under cer= tain - # conditions if [[ ${PN} !=3D "kgcc64" && ${PN} !=3D gcc-* ]] ; then - if tc_version_is_at_least "4.5" ; then - GCC_SRC_URI+=3D" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" - elif tc_version_is_at_least "4.3" ; then - GCC_SRC_URI+=3D" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )" - fi + GCC_SRC_URI+=3D" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" fi =20 echo "${GCC_SRC_URI}" @@ -326,85 +297,6 @@ get_make_var() { } XGCC() { get_make_var GCC_FOR_TARGET ; } =20 -# The gentoo piessp patches allow for 3 configurations: -# 1) PIE+SSP by default -# 2) PIE by default -# 3) SSP by default -hardened_gcc_works() { - if [[ $1 =3D=3D "pie" ]] ; then - # $gcc_cv_ld_pie is unreliable as it simply take the output of - # `ld --help | grep -- -pie`, that reports the option in all cases, al= so if - # the loader doesn't actually load the resulting executables. - # To avoid breakage, blacklist FreeBSD here at least - [[ ${CTARGET} =3D=3D *-freebsd* ]] && return 1 - - want_pie || return 1 - use_if_iuse nopie && return 1 - hardened_gcc_is_stable pie - return $? - elif [[ $1 =3D=3D "ssp" ]] ; then - [[ -n ${SPECS_VER} ]] || return 1 - use_if_iuse nossp && return 1 - hardened_gcc_is_stable ssp - return $? - else - # laziness ;) - hardened_gcc_works pie || return 1 - hardened_gcc_works ssp || return 1 - return 0 - fi -} - -hardened_gcc_is_stable() { - local tocheck - if [[ $1 =3D=3D "pie" ]] ; then - if [[ ${CTARGET} =3D=3D *-uclibc* ]] ; then - tocheck=3D${PIE_UCLIBC_STABLE} - else - tocheck=3D${PIE_GLIBC_STABLE} - fi - elif [[ $1 =3D=3D "ssp" ]] ; then - if [[ ${CTARGET} =3D=3D *-uclibc* ]] ; then - tocheck=3D${SSP_UCLIBC_STABLE} - else - tocheck=3D${SSP_STABLE} - fi - else - die "hardened_gcc_stable needs to be called with pie or ssp" - fi - - has $(tc-arch) ${tocheck} && return 0 - return 1 -} - -want_pie() { - ! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1 - [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0 - tc_version_is_at_least 4.3.2 && return 1 - [[ -z ${PIE_VER} ]] && return 1 - use !nopie && return 0 - return 1 -} - -want_minispecs() { - if tc_version_is_at_least 4.3.2 && use hardened ; then - if ! want_pie ; then - ewarn "PIE_VER or SPECS_VER is not defiend in the GCC ebuild." - elif use vanilla ; then - ewarn "You will not get hardened features if you have the vanilla USE= -flag." - elif use nopie && use nossp ; then - ewarn "You will not get hardened features if you have the nopie and n= ossp USE-flag." - elif ! hardened_gcc_works ; then - ewarn "Your $(tc-arch) arch is not supported." - else - return 0 - fi - ewarn "Hope you know what you are doing. Hardened will not work." - return 0 - fi - return 1 -} - # This is to make sure we don't accidentally try to enable support for a # language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f= 95, etc. # @@ -420,37 +312,6 @@ gcc-lang-supported() { =20 #---->> specs + env.d logic <<---- =20 -# configure to build with the hardened GCC specs as the default -make_gcc_hard() { - # defaults to enable for all hardened toolchains - local gcc_hard_flags=3D"-DEFAULT_RELRO -DEFAULT_BIND_NOW" - - if hardened_gcc_works ; then - einfo "Updating gcc to use automatic PIE + SSP building ..." - gcc_hard_flags+=3D" -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+=3D" -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+=3D" -DEFAULT_SSP" - else - # do nothing if hardened isnt supported, but dont die either - ewarn "hardened is not supported for this arch in this gcc version" - ebeep - return 0 - fi - - sed -i \ - -e "/^HARD_CFLAGS =3D /s|=3D|=3D ${gcc_hard_flags} |" \ - "${S}"/gcc/Makefile.in || die - - # rebrand to make bug reports easier - BRANDING_GCC_PKGVERSION=3D${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Harde= ned} -} - create_gcc_env_entry() { dodir /etc/env.d/gcc local gcc_envd_base=3D"/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}" @@ -498,21 +359,6 @@ create_gcc_env_entry() { # Set which specs file to use [[ -n ${gcc_specs_file} ]] && echo "GCC_SPECS=3D\"${gcc_specs_file}\"" = >> ${gcc_envd_file} } -setup_minispecs_gcc_build_specs() { - # Setup the "build.specs" file for gcc 4.3 to use when building. - if hardened_gcc_works pie ; then - cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs - fi - if hardened_gcc_works ssp ; then - for s in ssp sspall ; do - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs - done - fi - for s in nostrict znow ; do - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs - done - export GCC_SPECS=3D"${WORKDIR}"/build.specs -} copy_minispecs_gcc_specs() { # setup the hardenedno* specs files and the vanilla specs file. if hardened_gcc_works ; then @@ -527,14 +373,6 @@ copy_minispecs_gcc_specs() { create_gcc_env_entry vanilla insinto ${LIBPATH} doins "${WORKDIR}"/specs/*.specs || die "failed to install specs" - # Build system specs file which, if it exists, must be a complete set o= f - # specs as it completely and unconditionally overrides the builtin spec= s. - # For gcc 4.3 - if ! tc_version_is_at_least 4.4 ; then - $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs - cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs - doins "${WORKDIR}"/specs/specs || die "failed to install the specs fil= e" - fi } =20 #----<< specs + env.d logic >>---- @@ -560,8 +398,6 @@ pkg_setup() { use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to= USE=3D"-cxx"' fi =20 - want_minispecs - unset LANGUAGES #265283 } =20 @@ -583,23 +419,6 @@ pkg_postinst() { echo fi =20 - # If our gcc-config version doesn't like '-' in it's version string, - # tell our users that gcc-config will yell at them, but it's all good. - if ! has_version '>=3Dsys-devel/gcc-config-1.3.10-r1' && [[ ${GCC_CONFI= G_VER/-/} !=3D ${GCC_CONFIG_VER} ]] ; then - ewarn "Your version of gcc-config will issue about having an invalid p= rofile" - ewarn "when switching to this profile. It is safe to ignore this warni= ng," - ewarn "and this problem has been corrected in >=3Dsys-devel/gcc-config= -1.3.10-r1." - fi - - if ! is_crosscompile && ! use multislot && [[ ${GCCMAJOR}.${GCCMINOR} =3D= =3D 3.4 ]] ; then - echo - ewarn "You should make sure to rebuild all your C++ packages when" - ewarn "upgrading between different versions of gcc. For example," - ewarn "when moving to gcc-3.4 from gcc-3.3, emerge gentoolkit and run:= " - ewarn " # revdep-rebuild --library libstdc++.so.5" - echo - fi - if ! is_crosscompile ; then # hack to prevent collisions between SLOT [[ ! -d ${ROOT}/$(get_libdir)/rcscripts/awk ]] \ @@ -670,40 +489,6 @@ guess_patch_type_in_dir() { && EPATCH_SUFFIX=3D"patch.bz2" \ || EPATCH_SUFFIX=3D"patch" } -do_gcc_rename_java_bins() { - # bug #139918 - conflict between gcc and java-config-2 for ownership of - # /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch - # because patches would be large (thanks to the rename of man files), - # and it's clear from the sed invocations that all that changes is the - # rmi{c,registry} names to grmi{c,registry} names. - # Kevin F. Quinn 2006-07-12 - einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmir= egistry." - # 1) Move the man files if present (missing prior to gcc-3.4) - for manfile in rmic rmiregistry; do - [[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue - mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1 - done - # 2) Fixup references in the docs if present (mission prior to gcc-3.4) - for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gc= c/java/gcj.texi; do - [[ -f ${S}/${jfile} ]] || continue - sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || - die "Failed to fixup file ${jfile} for rename to grmiregistry" - sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} || - die "Failed to fixup file ${jfile} for rename to grmic" - done - # 3) Fixup Makefiles to build the changed executable names - # These are present in all 3.x versions, and are the important bit - # to get gcc to build with the new names. - for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang= .in; do - sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || - die "Failed to fixup file ${jfile} for rename to grmiregistry" - # Careful with rmic on these files; it's also the name of a directory - # which should be left unchanged. Replace occurrences of 'rmic$', - # 'rmic_' and 'rmic '. - sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} || - die "Failed to fixup file ${jfile} for rename to grmic" - done -} gcc-abi-map() { # Convert the ABI name we use in Gentoo to what gcc uses local map=3D() @@ -736,12 +521,7 @@ gcc-multilib-configure() { if [[ -n ${list} ]] ; then case ${CTARGET} in x86_64*) - # drop the 4.6.2 stuff once 4.7 goes stable - if tc_version_is_at_least 4.7 || - ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) ) - then - confgcc+=3D" --with-multilib-list=3D${list:1}" - fi + confgcc+=3D" --with-multilib-list=3D${list:1}" ;; esac fi @@ -749,68 +529,47 @@ gcc-multilib-configure() { gcc-compiler-configure() { gcc-multilib-configure =20 - if tc_version_is_at_least "4.0" ; then - if in_iuse mudflap ; then - confgcc+=3D" $(use_enable mudflap libmudflap)" - else - confgcc+=3D" --disable-libmudflap" - fi - - if use_if_iuse libssp ; then - confgcc+=3D" --enable-libssp" - else - export gcc_cv_libc_provides_ssp=3Dyes - confgcc+=3D" --disable-libssp" - fi - - # If we want hardened support with the newer piepatchset for >=3Dgcc 4= .4 - if tc_version_is_at_least 4.4 && want_minispecs ; then - confgcc+=3D" $(use_enable hardened esp)" - fi + if in_iuse mudflap ; then + confgcc+=3D" $(use_enable mudflap libmudflap)" + else + confgcc+=3D" --disable-libmudflap" + fi =20 - if tc_version_is_at_least "4.2" ; then - if in_iuse openmp ; then - # Make sure target has pthreads support. #326757 #335883 - # There shouldn't be a chicken&egg problem here as openmp won't - # build without a C library, and you can't build that w/out - # already having a compiler ... - if ! is_crosscompile || \ - $(tc-getCPP ${CTARGET}) -E - <<<"#include " >& /dev/nu= ll - then - confgcc+=3D" $(use_enable openmp libgomp)" - else - # Force disable as the configure script can be dumb #359855 - confgcc+=3D" --disable-libgomp" - fi - else - # For gcc variants where we don't want openmp (e.g. kgcc) - confgcc+=3D" --disable-libgomp" - fi - fi + confgcc+=3D" $(use_enable hardened espf)" =20 - # Stick the python scripts in their own slotted directory - # bug #279252 - # - # --with-python-dir=3DDIR - # Specifies where to install the Python modules used for aot-compile.= DIR - # should not include the prefix used in installation. For example, if= the - # Python modules are to be installed in /usr/lib/python2.5/site-packa= ges, - # then --with-python-dir=3D/lib/python2.5/site-packages should be pas= sed. - # - # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_= VER}/python" - if tc_version_is_at_least "4.4" ; then - confgcc+=3D" --with-python-dir=3D${DATAPATH/$PREFIX/}/python" + if in_iuse openmp ; then + # Make sure target has pthreads support. #326757 #335883 + # There shouldn't be a chicken&egg problem here as openmp won't + # build without a C library, and you can't build that w/out + # already having a compiler ... + if ! is_crosscompile || \ + $(tc-getCPP ${CTARGET}) -E - <<<"#include " >& /dev/nul= l + then + confgcc+=3D" $(use_enable openmp libgomp)" + else + # Force disable as the configure script can be dumb #359855 + confgcc+=3D" --disable-libgomp" fi + else + # For gcc variants where we don't want openmp (e.g. kgcc) + confgcc+=3D" --disable-libgomp" fi + # Stick the python scripts in their own slotted directory + # bug #279252 + # + # --with-python-dir=3DDIR + # Specifies where to install the Python modules used for aot-compile. = DIR + # should not include the prefix used in installation. For example, if = the + # Python modules are to be installed in /usr/lib/python2.5/site-packag= es, + # then --with-python-dir=3D/lib/python2.5/site-packages should be pass= ed. + # + # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_V= ER}/python" + confgcc+=3D" --with-python-dir=3D${DATAPATH/$PREFIX/}/python" =20 # For newer versions of gcc, use the default ("release"), because no # one (even upstream apparently) tests with it disabled. #317217 - if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then - confgcc+=3D" --enable-checking=3D${GCC_CHECKS_LIST:-release}" - else - confgcc+=3D" --disable-checking" - fi - + confgcc+=3D" --enable-checking=3D${GCC_CHECKS_LIST:-release}" +=09 # GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained # right now). Much thanks to for the heads up. # Travis Tilley (11 Jul 2004) @@ -822,13 +581,13 @@ gcc-compiler-configure() { =20 # newer gcc versions like to bootstrap themselves with C++, # so we need to manually disable it ourselves - if tc_version_is_at_least 4.7 && ! is_cxx ; then + if ! is_cxx ; then confgcc+=3D" --disable-build-with-cxx --disable-build-poststage1-with-= cxx" fi =20 # 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 + if ! is_fortran ; then confgcc+=3D" --disable-libquadmath" fi =20 @@ -847,8 +606,7 @@ gcc-compiler-configure() { fi =20 # Enable hardvfp - if [[ ${CTARGET##*-} =3D=3D *eabi ]] && [[ $(tc-is-hardfloat) =3D=3D = yes ]] && \ - tc_version_is_at_least "4.5" ; then + if [[ ${CTARGET##*-} =3D=3D *eabi ]] && [[ $(tc-is-hardfloat) =3D=3D = yes ]] ; then confgcc+=3D" --with-float=3Dhard" fi ;; @@ -886,9 +644,7 @@ gcc-compiler-configure() { is_go && GCC_LANG+=3D",go" if is_objc || is_objcxx ; then GCC_LANG+=3D",objc" - if tc_version_is_at_least "4.0" ; then - use objc-gc && confgcc+=3D" --enable-objc-gc" - fi + use objc-gc && confgcc+=3D" --enable-objc-gc" is_objcxx && GCC_LANG+=3D",obj-c++" fi is_treelang && GCC_LANG+=3D",treelang" @@ -930,31 +686,7 @@ gcc_do_filter_flags() { filter-flags '-mabi*' -m31 -m32 -m64 =20 case ${GCC_BRANCH_VER} in - 3.2|3.3) - replace-cpu-flags k8 athlon64 opteron i686 x86-64 - replace-cpu-flags pentium-m pentium3m pentium3 - case $(tc-arch) in - amd64|x86) filter-flags '-mtune=3D*' ;; - # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used, - # the compiler wrongly assumes a 32bit target - ppc64) filter-flags "-mcpu=3D*";; - esac - case $(tc-arch) in - amd64) replace-cpu-flags core2 nocona;; - x86) replace-cpu-flags core2 prescott;; - esac - - replace-cpu-flags G3 750 - replace-cpu-flags G4 7400 - replace-cpu-flags G5 7400 - - # XXX: should add a sed or something to query all supported flags - # from the gcc source and trim everything else ... - filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-re= fs - filter-flags -f{no-,}stack-protector{,-all} - filter-flags -fvisibility-inlines-hidden -fvisibility=3Dhidden - ;; - 3.4|4.*) + 4.*) case $(tc-arch) in x86|amd64) filter-flags '-mcpu=3D*';; *-macos) @@ -1041,9 +773,6 @@ gcc_slot_java() { # when installing gcc, it dumps internal libraries into /usr/lib # instead of the private gcc lib path gcc_movelibs() { - # older versions of gcc did not support --print-multi-os-directory - tc_version_is_at_least 3.0 || return 0 - local multiarg removedirs=3D"" for multiarg in $($(XGCC) -print-multi-lib) ; do multiarg=3D${multiarg#*;} @@ -1084,58 +813,12 @@ gcc_movelibs() { find "${D}" -type d | xargs rmdir >& /dev/null } =20 -do_gcc_HTB_patches() { - use_if_iuse boundschecking || return 0 - - # modify the bounds checking patch with a regression patch - epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch" - BRANDING_GCC_PKGVERSION=3D"${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VE= R}-${HTB_VER}" -} - -# do various updates to PIE logic -do_gcc_PIE_patches() { - want_pie || return 0 - - use vanilla && return 0 - - if tc_version_is_at_least 4.3.2; then - guess_patch_type_in_dir "${WORKDIR}"/piepatch/ - EPATCH_MULTI_MSG=3D"Applying pie patches ..." \ - epatch "${WORKDIR}"/piepatch/ - else - guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream - - # corrects startfile/endfile selection and shared/static/pie flag usag= e - EPATCH_MULTI_MSG=3D"Applying upstream pie patches ..." \ - epatch "${WORKDIR}"/piepatch/upstream - # adds non-default pie support (rs6000) - EPATCH_MULTI_MSG=3D"Applying non-default pie patches ..." \ - epatch "${WORKDIR}"/piepatch/nondef - # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is define= d - EPATCH_MULTI_MSG=3D"Applying default pie patches ..." \ - epatch "${WORKDIR}"/piepatch/def - fi -=09 - # we want to be able to control the pie patch logic via something other - # than ALL_CFLAGS... - sed -e '/^ALL_CFLAGS/iHARD_CFLAGS =3D ' \ - -e 's|^ALL_CFLAGS =3D |ALL_CFLAGS =3D $(HARD_CFLAGS) |' \ - -i "${S}"/gcc/Makefile.in - # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >=3D 4.7 - if tc_version_is_at_least 4.7.0 ; then - sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS =3D ' \ - -e 's|^ALL_CXXFLAGS =3D |ALL_CXXFLAGS =3D $(HARD= _CFLAGS) |' \ - -i "${S}"/gcc/Makefile.in - fi - - BRANDING_GCC_PKGVERSION=3D"${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}" -} - #---->> some function for src_* <<---- =20 #---->> src_* <<---- src_unpack() { - [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} =3D=3D *-uclibc* ]] && die "Sor= ry, this version does not support uClibc" + [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} =3D=3D *-uclibc* ]] && \ + die "Sorry, this version does not support uClibc" =20 if [[ ${PV} =3D=3D *9999* ]]; then git-2_src_unpack @@ -1186,11 +869,10 @@ src_unpack() { [[ -n ${UCLIBC_VER} ]] && \ unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2 =20 - if want_pie ; then + [[ -n ${PIE_VER} ]] && \ unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2 - [[ -n ${SPECS_VER} ]] && \ - unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2 - fi + [[ -n ${SPECS_VER} ]] && \ + unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2 =20 use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER= }-${HTB_VER}.patch.bz2" =20 @@ -1214,67 +896,46 @@ src_prepare() { epatch "${WORKDIR}"/uclibc fi fi - do_gcc_HTB_patches - do_gcc_PIE_patches + if use_if_iuse boundschecking ; then + # modify the bounds checking patch with a regression patch + epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch= " + BRANDING_GCC_PKGVERSION=3D"${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_V= ER}-${HTB_VER}" + fi + if use_if_iuse hardened && ! use_if_iuse nopie && [[ -n ${PIE_VER} ]] ;= then + guess_patch_type_in_dir "${WORKDIR}"/piepatch/ + EPATCH_MULTI_MSG=3D"Applying pie patches ..." \ + epatch "${WORKDIR}"/piepatch/ + BRANDING_GCC_PKGVERSION=3D"${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}" + fi epatch_user =20 - use hardened && make_gcc_hard + if use_if_iuse hardened ; then + BRANDING_GCC_PKGVERSION=3D${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hard= ened} + fi =20 # install the libstdc++ python into the right location # http://gcc.gnu.org/PR51368 - if tc_version_is_at_least 4.5 ; then - sed -i \ - '/^pythondir =3D/s:=3D.*:=3D $(datadir)/python:' \ - "${S}"/libstdc++-v3/python/Makefile.in || die - fi - - # No idea when this first started being fixed, but let's go with 4.3.x = for now - if ! tc_version_is_at_least 4.3 ; then - fix_files=3D"" - for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; d= o - [[ -e ${x} ]] && fix_files=3D"${fix_files} ${x}" - done - ht_fix_file ${fix_files} */configure *.sh */Makefile.in - fi - + sed -i \ + '/^pythondir =3D/s:=3D.*:=3D $(datadir)/python:' \ + "${S}"/libstdc++-v3/python/Makefile.in || die +=09 setup_multilib_osdirnames =20 - gcc_version_patch - if tc_version_is_at_least 4.1 ; then - if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then - # BASE-VER must be a three-digit version number - # followed by an optional -pre string - # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999 - # If BASE-VER differs from ${PV/_/-} then libraries get installed in - # the wrong directory. - echo ${PV/_/-} > "${S}"/gcc/BASE-VER - fi + if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then + # BASE-VER must be a three-digit version number + # followed by an optional -pre string + # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999 + # If BASE-VER differs from ${PV/_/-} then libraries get installed in + # the wrong directory. + echo ${PV/_/-} > "${S}"/gcc/BASE-VER fi - +=09 # >=3D gcc-4.3 doesn't bundle ecj.jar, so copy it - if tc_version_is_at_least 4.3 && use gcj ; then - if tc_version_is_at_least "4.5" ; then - einfo "Copying ecj-4.5.jar" - cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die - elif tc_version_is_at_least "4.3" ; then - einfo "Copying ecj-4.3.jar" - cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die - fi - fi - - # disable --as-needed from being compiled into gcc specs - # natively when using a gcc version < 3.4.4 - # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D14992 - if ! tc_version_is_at_least 3.4.4 ; then - sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in - fi - - # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names - # in line with gcc-4. - if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then - do_gcc_rename_java_bins + if use gcj ; then + einfo "Copying ecj-4.5.jar" + cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die fi - +=09 # Prevent libffi from being installed sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Make= file.in sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile= .in @@ -1288,7 +949,7 @@ src_prepare() { # update configure files local f einfo "Fixing misc issues in configure files" - tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-te= xinfo.patch + epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configur= e)) ; do ebegin " Updating ${f/${S}\/} [LANG]" patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/conf= igure-patch.log \ @@ -1318,11 +979,6 @@ src_configure() { # issues with 3rd party jar implementations. #384291 export JAR=3Dno =20 - # For hardened gcc 4.3 piepatchset to build the hardened specs - # file (build.specs) to use when building gcc. - if ! tc_version_is_at_least 4.4 && want_minispecs ; then - setup_minispecs_gcc_build_specs - fi # Build in a separate build tree mkdir -p "${WORKDIR}"/build pushd "${WORKDIR}"/build > /dev/null @@ -1371,7 +1027,7 @@ src_configure() { # gcc has fixed-point arithmetic support in 4.3 for mips targets that c= an # significantly increase compile time by several hours. This will allo= w # users to control this feature in the event they need the support. - tc_version_is_at_least "4.3" && confgcc+=3D" $(use_enable fixed-point)" + confgcc+=3D" $(use_enable fixed-point)" =20 # Graphite support was added in 4.4, which depends on external librarie= s # for optimizations. Current versions use cloog-ppl (cloog fork with P= arma @@ -1381,24 +1037,18 @@ src_configure() { # names are different). # # We disable the PPL version check so we can use >=3Dppl-0.11. - if tc_version_is_at_least "4.4"; then - confgcc+=3D" $(use_with graphite ppl)" - confgcc+=3D" $(use_with graphite cloog)" - if use graphite; then - confgcc+=3D" --disable-ppl-version-check" - confgcc+=3D" --with-cloog-include=3D/usr/include/cloog-ppl" - fi + confgcc+=3D" $(use_with graphite ppl)" + confgcc+=3D" $(use_with graphite cloog)" + if use graphite; then + confgcc+=3D" --disable-ppl-version-check" + confgcc+=3D" --with-cloog-include=3D/usr/include/cloog-ppl" fi - +=09 # LTO support was added in 4.5, which depends upon elfutils. This allo= ws # users to enable that option, and pull in the additional library. In = 4.6, # the dependency is no longer required. - if tc_version_is_at_least "4.6" ; then - confgcc+=3D" --enable-lto" - elif tc_version_is_at_least "4.5" ; then - confgcc+=3D" $(use_enable lto)" - fi - + confgcc+=3D" --enable-lto" +=09 [[ $(tc-is-softfloat) =3D=3D "yes" ]] && confgcc+=3D" --with-float=3Dso= ft" [[ $(tc-is-hardfloat) =3D=3D "yes" ]] && confgcc+=3D" --with-float=3Dha= rd" =20 @@ -1443,7 +1093,7 @@ src_configure() { fi fi =20 - tc_version_is_at_least 4.2 && confgcc+=3D" --disable-bootstrap" + confgcc+=3D" --disable-bootstrap" else if tc-is-static-only ; then confgcc+=3D" --disable-shared" @@ -1462,10 +1112,6 @@ src_configure() { case ${CTARGET} in *-uclibc*) confgcc+=3D" --disable-__cxa_atexit --enable-target-optspace $(use_ena= ble nptl tls)" - [[ ${GCCMAJOR}.${GCCMINOR} =3D=3D 3.3 ]] && confgcc+=3D" --enable-sjlj= -exceptions" - if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then - confgcc+=3D" --enable-clocale=3Duclibc" - fi ;; *-elf|*-eabi) confgcc+=3D" --with-newlib" @@ -1481,18 +1127,17 @@ src_configure() { confgcc+=3D" --enable-__cxa_atexit" ;; esac - tc_version_is_at_least 3.4 || confgcc+=3D" --disable-libunwind-exceptio= ns" - +=09 # if the target can do biarch (-m32/-m64), enable it. overhead should # be small, and should simplify building of 64bit kernels in a 32bit # userland by not needing sys-devel/kgcc64. #349405 case $(tc-arch) in - ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=3D" --enable-targets=3D= all" ;; - sparc) tc_version_is_at_least 4.4 && confgcc+=3D" --enable-targets=3D= all" ;; - amd64|x86) tc_version_is_at_least 4.3 && confgcc+=3D" --enable-targets=3D= all" ;; + ppc|ppc64) confgcc+=3D" --enable-targets=3Dall" ;; + sparc) confgcc+=3D" --enable-targets=3Dall" ;; + amd64|x86) confgcc+=3D" --enable-targets=3Dall" ;; esac =20 - tc_version_is_at_least 4.3 && set -- "$@" \ + set -- "$@" \ --with-bugurl=3Dhttp://bugs.gentoo.org/ \ --with-pkgversion=3D"${BRANDING_GCC_PKGVERSION}" set -- ${confgcc} "$@" ${EXTRA_ECONF} @@ -1554,9 +1199,6 @@ src_compile() { =20 if [[ ${GCC_MAKE_TARGET} =3D=3D "all" ]] ; then STAGE1_CFLAGS=3D${STAGE1_CFLAGS-"${CFLAGS}"} - elif [[ $(gcc-version) =3D=3D "3.4" && ${GCC_BRANCH_VER} =3D=3D "3.4" ]= ] && gcc-specs-ssp ; then - # See bug #79852 - STAGE1_CFLAGS=3D${STAGE1_CFLAGS-"-O2"} fi =20 if is_crosscompile; then @@ -1582,13 +1224,8 @@ src_compile() { =20 if ! is_crosscompile && use cxx && use doc ; then if type -p doxygen > /dev/null ; then - if tc_version_is_at_least 4.3 ; then - cd "${CTARGET}"/libstdc++-v3/doc - emake doc-man-doxygen || ewarn "failed to make docs" - elif tc_version_is_at_least 3.0 ; then - cd "${CTARGET}"/libstdc++-v3 - emake doxygen-man || ewarn "failed to make docs" - fi + cd "${CTARGET}"/libstdc++-v3/doc + emake doc-man-doxygen || ewarn "failed to make docs" else ewarn "Skipping libstdc++ manpage generation since you don't have dox= ygen installed" fi @@ -1636,9 +1273,9 @@ src_install() { create_gcc_env_entry =20 # Setup the gcc_env_entry for hardened gcc 4 with minispecs - if want_minispecs ; then - copy_minispecs_gcc_specs - fi + #if want_minispecs ; then + # copy_minispecs_gcc_specs + #fi # Make sure we dont have stuff lying around that # can nuke multiple versions of gcc =20 @@ -1745,10 +1382,8 @@ src_install() { export QA_WX_LOAD=3D"usr/lib*/go/*/*.gox" =20 # Disable RANDMMAP so PCH works. #301299 - if tc_version_is_at_least 4.3 ; then - pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc= 1" - pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc= 1plus" - fi + pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1= " + pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1= plus" } =20 #----<< src_* >>---- @@ -1829,27 +1464,6 @@ do_gcc_config() { gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs} } =20 -# This function allows us to gentoo-ize gcc's version number and bugzill= a -# URL without needing to use patches. -gcc_version_patch() { - # gcc-4.3+ has configure flags (whoo!) - tc_version_is_at_least 4.3 && return 0 - - local version_string=3D${GCC_CONFIG_VER} - [[ -n ${BRANCH_UPDATE} ]] && version_string+=3D" ${BRANCH_UPDATE}" - - einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSI= ON})" - - local gcc_sed=3D( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' ) - if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then - gcc_sed+=3D( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION}= )\":" ) - else - version_string=3D"${version_string} (${BRANDING_GCC_PKGVERSION})" - gcc_sed+=3D( -e "/const char version_string\[\] =3D /s:=3D \".*\":=3D = \"${version_string}\":" ) - fi - sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die -} - # This is a historical wart. The original Gentoo/amd64 port used: # lib32 - 32bit binaries (x86) # lib64 - 64bit binaries (x86_64) @@ -1883,13 +1497,7 @@ setup_multilib_osdirnames() { if [[ ${SYMLINK_LIB} =3D=3D "yes" ]] ; then einfo "updating multilib directories to be: ${libdirs}" # drop the 4.6.2 stuff once 4.7 goes stable - if tc_version_is_at_least 4.7 || - ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) ) - then - set -- -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' - else - set -- -e "/^MULTILIB_OSDIRNAMES/s:=3D.*:=3D ${libdirs}:" - fi + set -- -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' else einfo "using upstream multilib; disabling lib32 autodetection" set -- -r -e 's:[$][(]if.*,(.*)[)]:\1:' @@ -1933,7 +1541,6 @@ fix_libtool_libdir_paths() { } =20 is_multilib() { - tc_version_is_at_least 3 || return 1 use multilib } =20