--- toolchain.eclass 2006-10-09 19:09:56 +0200 +++ /usr/local/portage/eclass/toolchain.eclass 2006-10-10 08:01:40 +0200 @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.314 2006/10/02 22:35:50 vapier Exp $ +# $ HOMEPAGE="http://gcc.gnu.org/" LICENSE="GPL-2 LGPL-2.1" @@ -482,7 +482,7 @@ want_boundschecking() { _want_stuff HTB_VER boundschecking ; } want_pie() { _want_stuff PIE_VER !nopie ; } want_ssp() { gcc_has_native_ssp || _want_stuff PP_VER !nossp ; } -want_minispecs() { version_is_at_least "9.0.4" ${PIE_VER} && want_pie ; } +want_minispecs() { version_is_at_least "9.0.3" ${PIE_VER} && want_pie ; } want_split_specs() { [[ ${SPLIT_SPECS} == "true" ]] && want_pie @@ -585,11 +585,10 @@ _create_specs_file() { # Usage: _create_specs_file local uflag=$1 name=$2 flags=${*:3} + ebegin "Creating a ${name} gcc specs file" if want_minispecs ; then - einfo "Building ${name} gcc specs file" concat_minispecs hardened "${WORKDIR}"/build/${name}.specs else - ebegin "Creating a ${name} gcc specs file" pushd "${WORKDIR}"/build/gcc > /dev/null if [[ -z ${uflag} ]] || use ${uflag} ; then # backup the compiler first @@ -607,8 +606,8 @@ $(XGCC) -dumpspecs > "${WORKDIR}"/build/${name}.specs fi popd > /dev/null - eend $([[ -s ${WORKDIR}/build/${name}.specs ]] ; echo $?) fi + eend $([[ -s ${WORKDIR}/build/${name}.specs ]] ; echo $?) } create_vanilla_specs_file() { _create_specs_file hardened vanilla ; } create_hardened_specs_file() { _create_specs_file !hardened hardened ${gcc_common_hard} -DEFAULT_PIE_SSP ; } @@ -1694,7 +1693,7 @@ create_gcc_env_entry hardened fi - hardened_gcc_works pie && + hardened_gcc_works pie && create_gcc_env_entry hardenednossp hardened_gcc_works ssp && @@ -1703,11 +1702,7 @@ create_gcc_env_entry hardenednopiessp insinto ${LIBPATH} - if want_minispecs ; then - doins "${WORKDIR}"/specs/*.specs || die "failed to install minispecs" - else - doins "${WORKDIR}"/build/*.specs || die "failed to install specs" - fi + doins "${WORKDIR}"/build/*.specs || die "failed to install specs" fi # Make sure we dont have stuff lying around that @@ -2061,11 +2056,10 @@ if [[ ${PN} == "gcc" && ${sspdocs} == "no" ]] ; then epatch "${GCC_FILESDIR}"/pro-police-docs.patch fi - # gcc_has_native_ssp fi # Don't build crtbegin/end with ssp - sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |'\ + sed -e 's|^CRTSTUFF_CFLAGS = |CRTSTUFF_CFLAGS = -fno-stack-protector |' \ -i gcc/Makefile.in || die "Failed to update crtstuff!" # Don't build libgcc with ssp @@ -2078,7 +2072,6 @@ # it fails also on normal update from 3.4.4 to 4.x # this should be moved out of do_GCC_ssp_patches(), because it fails if gcc # is hardened, but we build w/ nossp as well -if false ; then # KFQ commented out to discover the stack smash if tc_version_is_at_least 3.4.0 ; then if tc_version_is_at_least 4.0.0 ; then if [[ ${GCCMINOR} -lt 2 ]] ; then @@ -2090,13 +2083,11 @@ epatch "${GCC_FILESDIR}"/3.4.0/gcc-3.4.0-cc1-no-stack-protector.patch fi fi -fi if gcc_has_native_ssp ; then - if [[ ${GCCMAJOR}.${GCCMINOR} == 4.0 ]] ; then - # Indicate that ssp support is a backport + # Indicate that ssp support is a backport + [[ ${GCCMAJOR}.${GCCMINOR} == 4.0 ]] && release_version="${release_version}, ssp-4.1-backport" - fi else release_version="${release_version}, ssp-${PP_FVER:-${PP_GCC_VER}-${PP_VER}}" fi @@ -2112,7 +2103,7 @@ # If glibc or uclibc has been patched to provide the necessary symbols itself, # then lets use those for SSP instead of libgcc. -# Legacy support for ancient gcc-3.x ssp patches +# Legacy support for ancient gcc-3.x ssp patches. update_gcc_for_libc_ssp() { if libc_has_ssp ; then einfo "Updating gcc to use SSP from libc ..." @@ -2132,20 +2123,11 @@ # do various updates to PIE logic do_gcc_PIE_patches() { if ! want_pie || \ - (want_boundschecking && [[ ${HTB_EXCLUSIVE} == "true" ]]) + (want_boundschecking && [[ ${HTB_EXCLUSIVE} == "true" ]]) then return 0 fi - if want_minispecs ; then - # Install minispecs to working directory, where they can be used - # in the compile/install phases. - mkdir "${WORKDIR}"/specs || - die "failed to make working specs directory" - cp -f ${FILESDIR}/specs/*specs "${WORKDIR}"/specs/ || - die "failed to install minispecs to working specs directory" - fi - want_boundschecking \ && rm -f "${WORKDIR}"/piepatch/*/*-boundschecking-no.patch* \ || rm -f "${WORKDIR}"/piepatch/*/*-boundschecking-yes.patch*