public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/hardened-dev:testing commit in: sys-devel/gcc/, eclass/
@ 2012-09-29 23:26 Magnus Granberg
  0 siblings, 0 replies; 4+ messages in thread
From: Magnus Granberg @ 2012-09-29 23:26 UTC (permalink / raw
  To: gentoo-commits

commit:     7f7ba617058812ae3207b83028b604e16235940d
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 29 23:24:59 2012 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Sep 29 23:24:59 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=7f7ba617

update gcc-4.8 repo

---
 eclass/toolchain.eclass                            |    8 ++++----
 eclass/{toolchain.eclass => toolchain.eclass~}     |   10 +++++-----
 ...20729.ebuild => gcc-4.8.0_alpha20120909.ebuild} |    2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 0740488..6ef4355 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -951,6 +951,7 @@ src_prepare() {
 		eautoreconf
 	done
 	cd "${S}"
+	autogen Makefile.def
 	elibtoolize --portage --shallow --no-uclibc
 
 	gnuconfig_update
@@ -1057,9 +1058,6 @@ src_configure() {
 	# users to enable that option, and pull in the additional library.  In 4.6,
 	# the dependency is no longer required.
 	confgcc+=" --enable-lto"
-	
-	[[ $(tc-is-softfloat) == "yes" ]] && confgcc+=" --with-float=soft"
-	[[ $(tc-is-hardfloat) == "yes" ]] && confgcc+=" --with-float=hard"
 
 	# Native Language Support
 	if use nls ; then
@@ -1071,9 +1069,10 @@ src_configure() {
 	# reasonably sane globals (hopefully)
 	confgcc+=" \
 		--with-system-zlib \
-		--disable-werror \
 		--enable-secureplt"
 
+# 		--disable-werror \
+
 	gcc-compiler-configure || die
 
 	if is_crosscompile ; then
@@ -1115,6 +1114,7 @@ src_configure() {
 			*)
 				confgcc+=" --enable-threads=posix" ;;
 		esac
+	in_iuse bootstrap && confgcc+=" --enable-bootstrap"
 	fi
 	# __cxa_atexit is "essential for fully standards-compliant handling of
 	# destructors", but apparently requires glibc.

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass~
similarity index 99%
copy from eclass/toolchain.eclass
copy to eclass/toolchain.eclass~
index 0740488..8e3c0a4 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass~
@@ -946,11 +946,12 @@ src_prepare() {
 	# Fixup libtool to correctly generate .la files with portage
 	cd "${S}"
 	eautoreconf
-	for subdirs in gcc ; do
+	for subdirs in gcc libcpp ; do
 		cd "${S}/${subdirs}/"
 		eautoreconf
 	done
 	cd "${S}"
+	autogen Makefile.def
 	elibtoolize --portage --shallow --no-uclibc
 
 	gnuconfig_update
@@ -1057,9 +1058,6 @@ src_configure() {
 	# users to enable that option, and pull in the additional library.  In 4.6,
 	# the dependency is no longer required.
 	confgcc+=" --enable-lto"
-	
-	[[ $(tc-is-softfloat) == "yes" ]] && confgcc+=" --with-float=soft"
-	[[ $(tc-is-hardfloat) == "yes" ]] && confgcc+=" --with-float=hard"
 
 	# Native Language Support
 	if use nls ; then
@@ -1071,9 +1069,10 @@ src_configure() {
 	# reasonably sane globals (hopefully)
 	confgcc+=" \
 		--with-system-zlib \
-		--disable-werror \
 		--enable-secureplt"
 
+# 		--disable-werror \
+
 	gcc-compiler-configure || die
 
 	if is_crosscompile ; then
@@ -1115,6 +1114,7 @@ src_configure() {
 			*)
 				confgcc+=" --enable-threads=posix" ;;
 		esac
+	in_iuse bootstrap && confgcc+=" --enable-bootstrap"
 	fi
 	# __cxa_atexit is "essential for fully standards-compliant handling of
 	# destructors", but apparently requires glibc.

diff --git a/sys-devel/gcc/gcc-4.8.0_alpha20120729.ebuild b/sys-devel/gcc/gcc-4.8.0_alpha20120909.ebuild
similarity index 96%
rename from sys-devel/gcc/gcc-4.8.0_alpha20120729.ebuild
rename to sys-devel/gcc/gcc-4.8.0_alpha20120909.ebuild
index bf2c159..1acd584 100644
--- a/sys-devel/gcc/gcc-4.8.0_alpha20120729.ebuild
+++ b/sys-devel/gcc/gcc-4.8.0_alpha20120909.ebuild
@@ -3,7 +3,7 @@
 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.6.2.ebuild,v 1.9 2012/03/15 20:21:44 vapier Exp $
 EAPI=4
 
-#PATCH_VER="1.4"
+PATCH_VER="1.0"
 
 inherit toolchain
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [gentoo-commits] proj/hardened-dev:testing commit in: sys-devel/gcc/, eclass/
@ 2012-10-07 16:44 Magnus Granberg
  0 siblings, 0 replies; 4+ messages in thread
From: Magnus Granberg @ 2012-10-07 16:44 UTC (permalink / raw
  To: gentoo-commits

commit:     74e43e37137230baba79a43eaa7c52c77b8e122e
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  7 16:44:39 2012 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Oct  7 16:44:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=74e43e37

Bump of the gcc 4.8 ebuild

---
 eclass/toolchain.eclass                            |    2 +-
 eclass/toolchain.eclass~                           |    2 +-
 ...20909.ebuild => gcc-4.8.0_alpha20120930.ebuild} |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 6ef4355..5717a32 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -946,7 +946,7 @@ src_prepare() {
 	# Fixup libtool to correctly generate .la files with portage
 	cd "${S}"
 	eautoreconf
-	for subdirs in gcc ; do
+	for subdirs in gcc libccp ; do
 		cd "${S}/${subdirs}/"
 		eautoreconf
 	done

diff --git a/eclass/toolchain.eclass~ b/eclass/toolchain.eclass~
index 8e3c0a4..6ef4355 100644
--- a/eclass/toolchain.eclass~
+++ b/eclass/toolchain.eclass~
@@ -946,7 +946,7 @@ src_prepare() {
 	# Fixup libtool to correctly generate .la files with portage
 	cd "${S}"
 	eautoreconf
-	for subdirs in gcc libcpp ; do
+	for subdirs in gcc ; do
 		cd "${S}/${subdirs}/"
 		eautoreconf
 	done

diff --git a/sys-devel/gcc/gcc-4.8.0_alpha20120909.ebuild b/sys-devel/gcc/gcc-4.8.0_alpha20120930.ebuild
similarity index 96%
rename from sys-devel/gcc/gcc-4.8.0_alpha20120909.ebuild
rename to sys-devel/gcc/gcc-4.8.0_alpha20120930.ebuild
index 1acd584..0e02680 100644
--- a/sys-devel/gcc/gcc-4.8.0_alpha20120909.ebuild
+++ b/sys-devel/gcc/gcc-4.8.0_alpha20120930.ebuild
@@ -3,7 +3,7 @@
 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.6.2.ebuild,v 1.9 2012/03/15 20:21:44 vapier Exp $
 EAPI=4
 
-PATCH_VER="1.0"
+#PATCH_VER="1.0"
 
 inherit toolchain
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [gentoo-commits] proj/hardened-dev:testing commit in: sys-devel/gcc/, eclass/
@ 2012-08-01 18:37 Magnus Granberg
  0 siblings, 0 replies; 4+ messages in thread
From: Magnus Granberg @ 2012-08-01 18:37 UTC (permalink / raw
  To: gentoo-commits

commit:     cf3b8a789ce9b8f3095b49df0ff0ef69ff3f44ec
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  1 18:36:57 2012 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Wed Aug  1 18:36:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=cf3b8a78

bump of the ebuild to 20120729

---
 eclass/toolchain.eclass                            |    7 +++++--
 ...20401.ebuild => gcc-4.8.0_alpha20120729.ebuild} |    0
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 1df8004..0740488 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -534,8 +534,11 @@ gcc-compiler-configure() {
 	else
 		confgcc+=" --disable-libmudflap"
 	fi
-
-	confgcc+=" $(use_enable hardened espf)"
+	if use hardened ; then
+		confgcc+=" --enable-espf=all"
+	else
+		confgcc+=" --enable-espf=no"
+	fi
 
 	if in_iuse openmp ; then
 		# Make sure target has pthreads support. #326757 #335883

diff --git a/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild b/sys-devel/gcc/gcc-4.8.0_alpha20120729.ebuild
similarity index 100%
rename from sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
rename to sys-devel/gcc/gcc-4.8.0_alpha20120729.ebuild


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [gentoo-commits] proj/hardened-dev:testing commit in: sys-devel/gcc/, eclass/
@ 2012-04-07 19:11 Magnus Granberg
  0 siblings, 0 replies; 4+ messages in thread
From: Magnus Granberg @ 2012-04-07 19:11 UTC (permalink / raw
  To: gentoo-commits

commit:     4462a08a4a276088d8b5cc608f9e31848844a0da
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  7 19:10:02 2012 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Apr  7 19:10:02 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=4462a08a

toolchain eclass eapi4 port

---
 eclass/{toolchain2.eclass => toolchain.eclass} | 1145 +++++++++++-------------
 eclass/toolchain2.eclass                       |  566 +++----------
 sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild   |   18 +-
 3 files changed, 655 insertions(+), 1074 deletions(-)

diff --git a/eclass/toolchain2.eclass b/eclass/toolchain.eclass
similarity index 96%
copy from eclass/toolchain2.eclass
copy to eclass/toolchain.eclass
index b5c0aa0..aa00f09 100644
--- a/eclass/toolchain2.eclass
+++ b/eclass/toolchain.eclass
@@ -23,13 +23,11 @@ if [[ ${PV} == *_pre9999* ]] ; then
 	inherit git-2
 fi
 
-EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
 DESCRIPTION="The GNU Compiler Collection"
 
 FEATURES=${FEATURES/multilib-strict/}
 #----<< eclass stuff >>----
 
-
 #---->> globals <<----
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} = ${CHOST} ]] ; then
@@ -91,7 +89,6 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
 
 #----<< globals >>----
 
-
 #---->> SLOT+IUSE logic <<----
 IUSE="build multislot nls nptl test vanilla"
 
@@ -319,7 +316,6 @@ get_gcc_src_uri() {
 SRC_URI=$(get_gcc_src_uri)
 #---->> S + SRC_URI essentials >>----
 
-
 #---->> support checks <<----
 
 # Grab a variable from the build system (taken from linux-info.eclass)
@@ -544,13 +540,8 @@ copy_minispecs_gcc_specs() {
 #----<< specs + env.d logic >>----
 
 #---->> pkg_* <<----
-toolchain_pkg_setup() {
-	if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
-	   [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]]
-	then
-		die "Please \`export I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS=1\` or define it in your make.conf if you want to use this version." \
-			"This is to try and cut down on people filing bugs for a compiler we do not currently support."
-	fi
+
+pkg_setup() {
 
 	# Setup variables which would normally be in the profile
 	if is_crosscompile ; then
@@ -574,11 +565,11 @@ toolchain_pkg_setup() {
 	unset LANGUAGES #265283
 }
 
-toolchain_pkg_preinst() {
+pkg_preinst() {
 	:
 }
 
-toolchain_pkg_postinst() {
+pkg_postinst() {
 	do_gcc_config
 
 	if ! is_crosscompile ; then
@@ -630,13 +621,13 @@ toolchain_pkg_postinst() {
 	fi
 }
 
-toolchain_pkg_prerm() {
+pkg_prerm() {
 	# Don't let these files be uninstalled #87647
 	touch -c "${ROOT}"/sbin/fix_libtool_files.sh \
 		"${ROOT}"/$(get_libdir)/rcscripts/awk/fixlafiles.awk
 }
 
-toolchain_pkg_postrm() {
+pkg_postrm() {
 	# to make our lives easier (and saner), we do the fix_libtool stuff here.
 	# rather than checking SLOT's and trying in upgrade paths, we just see if
 	# the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
@@ -672,7 +663,7 @@ toolchain_pkg_postrm() {
 
 #---->> pkg_* <<----
 
-#---->> src_* <<----
+#---->> some function for src_* <<----
 
 guess_patch_type_in_dir() {
 	[[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
@@ -713,125 +704,6 @@ do_gcc_rename_java_bins() {
 			die "Failed to fixup file ${jfile} for rename to grmic"
 	done
 }
-toolchain_src_unpack() {
-	[[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
-
-	if [[ ${PV} == *9999* ]]; then
-		git-2_src_unpack
-	else
-		gcc_quick_unpack
-	fi
-
-	export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
-	cd "${S}"
-
-	if ! use vanilla ; then
-		if [[ -n ${PATCH_VER} ]] ; then
-			guess_patch_type_in_dir "${WORKDIR}"/patch
-			EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
-			epatch "${WORKDIR}"/patch
-			BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
-		fi
-		if [[ -n ${UCLIBC_VER} ]] ; then
-			guess_patch_type_in_dir "${WORKDIR}"/uclibc
-			EPATCH_MULTI_MSG="Applying uClibc patches ..." \
-			epatch "${WORKDIR}"/uclibc
-		fi
-	fi
-	do_gcc_HTB_patches
-	do_gcc_PIE_patches
-	epatch_user
-
-	use hardened && make_gcc_hard
-
-	# 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 =/s:=.*:= $(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=""
-		for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
-			[[ -e ${x} ]] && fix_files="${fix_files} ${x}"
-		done
-		ht_fix_file ${fix_files} */configure *.sh */Makefile.in
-	fi
-
-	setup_multilib_osdirnames
-
-	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
-	fi
-
-	# >= 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=14992
-	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
-	fi
-
-	# Prevent libffi from being installed
-	sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
-	sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in
-
-	# Fixup libtool to correctly generate .la files with portage
-	cd "${S}"
-	elibtoolize --portage --shallow --no-uclibc
-
-	gnuconfig_update
-
-	# update configure files
-	local f
-	einfo "Fixing misc issues in configure files"
-	tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
-	for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
-		ebegin "  Updating ${f/${S}\/} [LANG]"
-		patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
-			|| eerror "Please file a bug about this"
-		eend $?
-	done
-	sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
-
-	if [[ -x contrib/gcc_update ]] ; then
-		einfo "Touching generated files"
-		./contrib/gcc_update --touch | \
-			while read f ; do
-				einfo "  ${f%%...}"
-			done
-	fi
-
-	disable_multilib_libjava || die "failed to disable multilib java"
-}
-
 gcc-abi-map() {
 	# Convert the ABI name we use in Gentoo to what gcc uses
 	local map=()
@@ -846,7 +718,6 @@ gcc-abi-map() {
 		[[ $1 == ${l[0]} ]] && echo ${l[1]} && break
 	done
 }
-
 gcc-multilib-configure() {
 	# if multilib is disabled, get out quick!
 	if ! is_multilib ; then
@@ -875,7 +746,6 @@ gcc-multilib-configure() {
 		esac
 	fi
 }
-
 gcc-compiler-configure() {
 	gcc-multilib-configure
 
@@ -1036,74 +906,493 @@ gcc-compiler-configure() {
 	einfo "configuring for GCC_LANG: ${GCC_LANG}"
 	confgcc+=" --enable-languages=${GCC_LANG}"
 }
+has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
+toolchain_death_notice() {
+	pushd "${WORKDIR}"/build >/dev/null
+	tar jcf gcc-build-logs.tar.bz2 $(find -name config.log)
+	eerror
+	eerror "Please include ${PWD}/gcc-build-logs.tar.bz2 in your bug report"
+	eerror
+	popd >/dev/null
+}
+# This is mostly a stub function to be overwritten in an ebuild
+gcc_do_filter_flags() {
+	strip-flags
 
-gcc_do_configure() {
-	local confgcc
+	# In general gcc does not like optimization, and add -O2 where
+	# it is safe.  This is especially true for gcc 3.3 + 3.4
+	replace-flags -O? -O2
 
-	# Sanity check for USE=nocxx -> USE=cxx migration
-	if in_iuse cxx && in_iuse nocxx ; then
-		if (use cxx && use nocxx) || (use !cxx && use !nocxx) ; then
-			eerror "We are migrating USE=nocxx to USE=cxx, but your USE settings do not make"
-			eerror "sense.  Please make sure these two flags line up logically in your setup."
-			die "USE='cxx nocxx' and USE='-cxx -nocxx' make no sense"
-		fi
-	fi
+	# ... sure, why not?
+	strip-unsupported-flags
 
-	# Set configuration based on path variables
-	confgcc+=" \
-		--prefix=${PREFIX} \
-		--bindir=${BINPATH} \
-		--includedir=${INCLUDEPATH} \
-		--datadir=${DATAPATH} \
-		--mandir=${DATAPATH}/man \
-		--infodir=${DATAPATH}/info \
-		--with-gxx-include-dir=${STDCXX_INCDIR}"
-	# On Darwin we need libdir to be set in order to get correct install names
-	# for things like libobjc-gnu, libgcj and libfortran.  If we enable it on
-	# non-Darwin we screw up the behaviour this eclass relies on.  We in
-	# particular need this over --libdir for bug #255315.
-	[[ ${CTARGET} == *-darwin* ]] && \
-		confgcc+=" --enable-version-specific-runtime-libs"
+	# dont want to funk ourselves
+	filter-flags '-mabi*' -m31 -m32 -m64
 
-	# All our cross-compile logic goes here !  woo !
-	confgcc+=" --host=${CHOST}"
-	if is_crosscompile || tc-is-cross-compiler ; then
-		# Straight from the GCC install doc:
-		# "GCC has code to correctly determine the correct value for target
-		# for nearly all native systems. Therefore, we highly recommend you
-		# not provide a configure target when configuring a native compiler."
-		confgcc+=" --target=${CTARGET}"
-	fi
-	[[ -n ${CBUILD} ]] && confgcc+=" --build=${CBUILD}"
+	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=*' ;;
+			# 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=*";;
+		esac
+		case $(tc-arch) in
+			amd64) replace-cpu-flags core2 nocona;;
+			x86)   replace-cpu-flags core2 prescott;;
+		esac
 
-	# ppc altivec support
-	confgcc+=" $(use_enable altivec)"
+		replace-cpu-flags G3 750
+		replace-cpu-flags G4 7400
+		replace-cpu-flags G5 7400
 
-	# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
-	# significantly increase compile time by several hours.  This will allow
-	# users to control this feature in the event they need the support.
-	tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
+		# 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-refs
+		filter-flags -f{no-,}stack-protector{,-all}
+		filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
+		;;
+	3.4|4.*)
+		case $(tc-arch) in
+			x86|amd64) filter-flags '-mcpu=*';;
+			*-macos)
+				# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127
+				[[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER}  == 4.1 ]] && \
+					filter-flags '-mcpu=*' '-march=*' '-mtune=*'
+			;;
+		esac
+		;;
+	esac
 
-	# Graphite support was added in 4.4, which depends on external libraries
-	# for optimizations.  Current versions use cloog-ppl (cloog fork with Parma
-	# PPL backend).  Sometime in the future we will use upstream cloog with the
-	# ISL backend (note: PPL will still be a requirement).  cloog-ppl's include
-	# path was modified to prevent collisions between the two packages (library
-	# names are different).
+	# Compile problems with these (bug #6641 among others)...
+	#filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr"
+
+	# CFLAGS logic (verified with 3.4.3):
+	# CFLAGS:
+	#	This conflicts when creating a crosscompiler, so set to a sane
+	#	  default in this case:
+	#	used in ./configure and elsewhere for the native compiler
+	#	used by gcc when creating libiberty.a
+	#	used by xgcc when creating libstdc++ (and probably others)!
+	#	  this behavior should be removed...
 	#
-	# We disable the PPL version check so we can use >=ppl-0.11.
-	if tc_version_is_at_least "4.4"; then
-		confgcc+=" $(use_with graphite ppl)"
-		confgcc+=" $(use_with graphite cloog)"
-		if use graphite; then
-			confgcc+=" --disable-ppl-version-check"
-			confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
-		fi
-	fi
+	# CXXFLAGS:
+	#	used by xgcc when creating libstdc++
+	#
+	# STAGE1_CFLAGS (not used in creating a crosscompile gcc):
+	#	used by ${CHOST}-gcc for building stage1 compiler
+	#
+	# BOOT_CFLAGS (not used in creating a crosscompile gcc):
+	#	used by xgcc for building stage2/3 compiler
 
-	# LTO support was added in 4.5, which depends upon elfutils.  This allows
-	# users to enable that option, and pull in the additional library.  In 4.6,
-	# the dependency is no longer required.
+	if is_crosscompile ; then
+		# Set this to something sane for both native and target
+		CFLAGS="-O2 -pipe"
+
+		local VAR="CFLAGS_"${CTARGET//-/_}
+		CXXFLAGS=${!VAR}
+	fi
+
+	export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
+}
+gcc_slot_java() {
+	local x
+
+	# Move Java headers to compiler-specific dir
+	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
+		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
+	done
+	for x in gcj gnu java javax org ; do
+		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
+			dodir /${LIBPATH}/include/${x}
+			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
+			rm -rf "${D}"${PREFIX}/include/${x}
+		fi
+	done
+
+	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
+		dodir /${LIBPATH}/security
+		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
+		rm -rf "${D}"${PREFIX}/lib*/security
+	fi
+
+	# Move random gcj files to compiler-specific directories
+	for x in libgcj.spec logging.properties ; do
+		x="${D}${PREFIX}/lib/${x}"
+		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
+	done
+
+	# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
+	for x in "${D}"${PREFIX}/lib*/pkgconfig/libgcj*.pc ; do
+		[[ -f ${x} ]] || continue
+		sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${x}"
+		mv "${x}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die
+	done
+
+	# Rename jar because it could clash with Kaffe's jar if this gcc is
+	# primary compiler (aka don't have the -<version> extension)
+	cd "${D}"${BINPATH}
+	[[ -f jar ]] && mv -f jar gcj-jar
+}
+
+# Move around the libs to the right location.  For some reason,
+# 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=""
+	for multiarg in $($(XGCC) -print-multi-lib) ; do
+		multiarg=${multiarg#*;}
+		multiarg=${multiarg//@/ -}
+
+		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
+		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
+		local TODIR=${D}${LIBPATH}/${MULTIDIR}
+		local FROMDIR=
+
+		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
+
+		for FROMDIR in \
+			${LIBPATH}/${OS_MULTIDIR} \
+			${LIBPATH}/../${MULTIDIR} \
+			${PREFIX}/lib/${OS_MULTIDIR} \
+			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
+		do
+			removedirs="${removedirs} ${FROMDIR}"
+			FROMDIR=${D}${FROMDIR}
+			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
+				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
+				if [[ -n ${files} ]] ; then
+					mv ${files} "${TODIR}"
+				fi
+			fi
+		done
+		fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
+	done
+
+	# We remove directories separately to avoid this case:
+	#	mv SRC/lib/../lib/*.o DEST
+	#	rmdir SRC/lib/../lib/
+	#	mv SRC/lib/../lib32/*.o DEST  # Bork
+	for FROMDIR in ${removedirs} ; do
+		rmdir "${D}"${FROMDIR} >& /dev/null
+	done
+	find "${D}" -type d | xargs rmdir >& /dev/null
+}
+
+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="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${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="Applying pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/
+	else
+		guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
+
+		# corrects startfile/endfile selection and shared/static/pie flag usage
+		EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/upstream
+		# adds non-default pie support (rs6000)
+		EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/nondef
+		# adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
+		EPATCH_MULTI_MSG="Applying default pie patches ..." \
+		epatch "${WORKDIR}"/piepatch/def
+	fi
+	
+	# we want to be able to control the pie patch logic via something other
+	# than ALL_CFLAGS...
+	sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
+		-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
+		-i "${S}"/gcc/Makefile.in
+	# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
+	if tc_version_is_at_least 4.7.0 ; then
+		sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
+                        -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
+                        -i "${S}"/gcc/Makefile.in
+	fi
+
+	BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
+}
+
+#---->> some function for src_* <<----
+
+#---->> src_* <<----
+src_unpack() {
+	[[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
+
+	if [[ ${PV} == *9999* ]]; then
+		git-2_src_unpack
+		return
+	fi
+
+	pushd "${WORKDIR}" > /dev/null
+	export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
+	export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
+	export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
+	export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
+	export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
+
+	if [[ -n ${GCC_A_FAKEIT} ]] ; then
+		unpack ${GCC_A_FAKEIT}
+	elif [[ -n ${PRERELEASE} ]] ; then
+		unpack gcc-${PRERELEASE}.tar.bz2
+	elif [[ -n ${SNAPSHOT} ]] ; then
+		unpack gcc-${SNAPSHOT}.tar.bz2
+	elif [[ ${PV} != *9999* ]] ; then
+		unpack gcc-${GCC_RELEASE_VER}.tar.bz2
+		# We want branch updates to be against a release tarball
+		if [[ -n ${BRANCH_UPDATE} ]] ; then
+			pushd "${S}" > /dev/null
+			epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
+			popd > /dev/null
+		fi
+	fi
+
+	if [[ -n ${D_VER} ]] && use d ; then
+		pushd "${S}"/gcc > /dev/null
+		unpack gdc-${D_VER}-src.tar.bz2
+		cd ..
+		ebegin "Adding support for the D language"
+		./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
+		if ! eend $? ; then
+			eerror "The D gcc package failed to apply"
+			eerror "Please include this log file when posting a bug report:"
+			eerror "  ${T}/dgcc.log"
+			die "failed to include the D language"
+		fi
+		popd > /dev/null
+	fi
+
+	[[ -n ${PATCH_VER} ]] && \
+		unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
+
+	[[ -n ${UCLIBC_VER} ]] && \
+		unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
+
+	if want_pie ; then
+		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
+
+	use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
+
+	popd > /dev/null
+
+}
+src_prepare() {
+	export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
+	cd "${S}"
+
+	if ! use vanilla ; then
+		if [[ -n ${PATCH_VER} ]] ; then
+			guess_patch_type_in_dir "${WORKDIR}"/patch
+			EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
+			epatch "${WORKDIR}"/patch
+			BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
+		fi
+		if [[ -n ${UCLIBC_VER} ]] ; then
+			guess_patch_type_in_dir "${WORKDIR}"/uclibc
+			EPATCH_MULTI_MSG="Applying uClibc patches ..." \
+			epatch "${WORKDIR}"/uclibc
+		fi
+	fi
+	do_gcc_HTB_patches
+	do_gcc_PIE_patches
+	epatch_user
+
+	use hardened && make_gcc_hard
+
+	# 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 =/s:=.*:= $(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=""
+		for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
+			[[ -e ${x} ]] && fix_files="${fix_files} ${x}"
+		done
+		ht_fix_file ${fix_files} */configure *.sh */Makefile.in
+	fi
+
+	setup_multilib_osdirnames
+
+	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
+	fi
+
+	# >= 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=14992
+	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
+	fi
+
+	# Prevent libffi from being installed
+	sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
+	sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in
+
+	# Fixup libtool to correctly generate .la files with portage
+	cd "${S}"
+	elibtoolize --portage --shallow --no-uclibc
+
+	gnuconfig_update
+
+	# update configure files
+	local f
+	einfo "Fixing misc issues in configure files"
+	tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
+	for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
+		ebegin "  Updating ${f/${S}\/} [LANG]"
+		patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
+			|| eerror "Please file a bug about this"
+		eend $?
+	done
+	sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
+
+	if [[ -x contrib/gcc_update ]] ; then
+		einfo "Touching generated files"
+		./contrib/gcc_update --touch | \
+			while read f ; do
+				einfo "  ${f%%...}"
+			done
+	fi
+
+	disable_multilib_libjava || die "failed to disable multilib java"
+}
+src_configure() {
+
+	multilib_env ${CTARGET}
+	gcc_do_filter_flags
+	einfo "CFLAGS=\"${CFLAGS}\""
+	einfo "CXXFLAGS=\"${CXXFLAGS}\""
+
+	# Force internal zip based jar script to avoid random
+	# issues with 3rd party jar implementations.  #384291
+	export JAR=no
+
+	# 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
+
+	local confgcc
+
+	# Sanity check for USE=nocxx -> USE=cxx migration
+	if in_iuse cxx && in_iuse nocxx ; then
+		if (use cxx && use nocxx) || (use !cxx && use !nocxx) ; then
+			eerror "We are migrating USE=nocxx to USE=cxx, but your USE settings do not make"
+			eerror "sense.  Please make sure these two flags line up logically in your setup."
+			die "USE='cxx nocxx' and USE='-cxx -nocxx' make no sense"
+		fi
+	fi
+
+	# Set configuration based on path variables
+	confgcc+=" \
+		--prefix=${PREFIX} \
+		--bindir=${BINPATH} \
+		--includedir=${INCLUDEPATH} \
+		--datadir=${DATAPATH} \
+		--mandir=${DATAPATH}/man \
+		--infodir=${DATAPATH}/info \
+		--with-gxx-include-dir=${STDCXX_INCDIR}"
+	# On Darwin we need libdir to be set in order to get correct install names
+	# for things like libobjc-gnu, libgcj and libfortran.  If we enable it on
+	# non-Darwin we screw up the behaviour this eclass relies on.  We in
+	# particular need this over --libdir for bug #255315.
+	[[ ${CTARGET} == *-darwin* ]] && \
+		confgcc+=" --enable-version-specific-runtime-libs"
+
+	# All our cross-compile logic goes here !  woo !
+	confgcc+=" --host=${CHOST}"
+	if is_crosscompile || tc-is-cross-compiler ; then
+		# Straight from the GCC install doc:
+		# "GCC has code to correctly determine the correct value for target
+		# for nearly all native systems. Therefore, we highly recommend you
+		# not provide a configure target when configuring a native compiler."
+		confgcc+=" --target=${CTARGET}"
+	fi
+	[[ -n ${CBUILD} ]] && confgcc+=" --build=${CBUILD}"
+
+	# ppc altivec support
+	confgcc+=" $(use_enable altivec)"
+
+	# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
+	# significantly increase compile time by several hours.  This will allow
+	# users to control this feature in the event they need the support.
+	tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
+
+	# Graphite support was added in 4.4, which depends on external libraries
+	# for optimizations.  Current versions use cloog-ppl (cloog fork with Parma
+	# PPL backend).  Sometime in the future we will use upstream cloog with the
+	# ISL backend (note: PPL will still be a requirement).  cloog-ppl's include
+	# path was modified to prevent collisions between the two packages (library
+	# names are different).
+	#
+	# We disable the PPL version check so we can use >=ppl-0.11.
+	if tc_version_is_at_least "4.4"; then
+		confgcc+=" $(use_with graphite ppl)"
+		confgcc+=" $(use_with graphite cloog)"
+		if use graphite; then
+			confgcc+=" --disable-ppl-version-check"
+			confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
+		fi
+	fi
+
+	# LTO support was added in 4.5, which depends upon elfutils.  This allows
+	# 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+=" --enable-lto"
 	elif tc_version_is_at_least "4.5" ; then
@@ -1226,44 +1515,19 @@ gcc_do_configure() {
 	# and now to do the actual configuration
 	addwrite /dev/zero
 	echo "${S}"/configure "$@"
-	"${S}"/configure "$@" || die "failed to run configure"
-
+	"${S}"/configure "$@" || die "failed to run configure."
 	# return to whatever directory we were in before
 	popd > /dev/null
-}
 
-has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
-toolchain_death_notice() {
-	pushd "${WORKDIR}"/build >/dev/null
-	tar jcf gcc-build-logs.tar.bz2 $(find -name config.log)
-	eerror
-	eerror "Please include ${PWD}/gcc-build-logs.tar.bz2 in your bug report"
-	eerror
-	popd >/dev/null
+	touch "${S}"/gcc/c-gperf.h
 }
 
-# This function accepts one optional argument, the make target to be used.
-# If ommitted, gcc_do_make will try to guess whether it should use all,
-# profiledbootstrap, or bootstrap-lean depending on CTARGET and arch. An
-# example of how to use this function:
-#
-#	gcc_do_make all-target-libstdc++-v3
-#
-# In addition to the target to be used, the following variables alter the
-# behavior of this function:
-#
-#	LDFLAGS
-#			Flags to pass to ld
-#
-#	STAGE1_CFLAGS
-#			CFLAGS to use during stage1 of a gcc bootstrap
-#
-#	BOOT_CFLAGS
-#			CFLAGS to use during stages 2+3 of a gcc bootstrap.
-#
-# Travis Tilley <lv@gentoo.org> (04 Sep 2004)
-#
-gcc_do_make() {
+src_compile() {
+	# Do not make manpages if we do not have perl ...
+	[[ ! -x /usr/bin/perl ]] \
+		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
+
+	einfo "Compiling ${PN} ..."
 	# Fix for libtool-portage.patch
 	local OLDS=${S}
 	S=${WORKDIR}/build
@@ -1274,188 +1538,71 @@ gcc_do_make() {
 	if is_crosscompile || tc-is-cross-compiler ; then
 		# 3 stage bootstrapping doesnt quite work when you cant run the
 		# resulting binaries natively ^^;
-		GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
-	else
-		GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
-	fi
-
-	# the gcc docs state that parallel make isnt supported for the
-	# profiledbootstrap target, as collisions in profile collecting may occur.
-	# boundschecking also seems to introduce parallel build issues.
-	if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ||
-	   use_if_iuse boundschecking
-	then
-		export MAKEOPTS="${MAKEOPTS} -j1"
-	fi
-
-	if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
-		STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
-	elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
-		# See bug #79852
-		STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
-	fi
-
-	if is_crosscompile; then
-		# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
-		# but I'll leave this in anyways as someone might have had
-		# some reason for putting it in here... --eradicator
-		BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
-	else
-		# we only want to use the system's CFLAGS if not building a
-		# cross-compiler.
-		BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS) ${CFLAGS}"}
-	fi
-
-	pushd "${WORKDIR}"/build
-
-	emake \
-		LDFLAGS="${LDFLAGS}" \
-		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
-		LIBPATH="${LIBPATH}" \
-		BOOT_CFLAGS="${BOOT_CFLAGS}" \
-		${GCC_MAKE_TARGET} \
-		|| die "emake failed with ${GCC_MAKE_TARGET}"
-
-	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
-		else
-			ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
-		fi
-	fi
-
-	popd
-}
-
-# This is mostly a stub function to be overwritten in an ebuild
-gcc_do_filter_flags() {
-	strip-flags
-
-	# In general gcc does not like optimization, and add -O2 where
-	# it is safe.  This is especially true for gcc 3.3 + 3.4
-	replace-flags -O? -O2
-
-	# ... sure, why not?
-	strip-unsupported-flags
-
-	# dont want to funk ourselves
-	filter-flags '-mabi*' -m31 -m32 -m64
-
-	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=*' ;;
-			# 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=*";;
-		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-refs
-		filter-flags -f{no-,}stack-protector{,-all}
-		filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
-		;;
-	3.4|4.*)
-		case $(tc-arch) in
-			x86|amd64) filter-flags '-mcpu=*';;
-			*-macos)
-				# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127
-				[[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER}  == 4.1 ]] && \
-					filter-flags '-mcpu=*' '-march=*' '-mtune=*'
-			;;
-		esac
-		;;
-	esac
-
-	# Compile problems with these (bug #6641 among others)...
-	#filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr"
-
-	# CFLAGS logic (verified with 3.4.3):
-	# CFLAGS:
-	#	This conflicts when creating a crosscompiler, so set to a sane
-	#	  default in this case:
-	#	used in ./configure and elsewhere for the native compiler
-	#	used by gcc when creating libiberty.a
-	#	used by xgcc when creating libstdc++ (and probably others)!
-	#	  this behavior should be removed...
-	#
-	# CXXFLAGS:
-	#	used by xgcc when creating libstdc++
-	#
-	# STAGE1_CFLAGS (not used in creating a crosscompile gcc):
-	#	used by ${CHOST}-gcc for building stage1 compiler
-	#
-	# BOOT_CFLAGS (not used in creating a crosscompile gcc):
-	#	used by xgcc for building stage2/3 compiler
-
-	if is_crosscompile ; then
-		# Set this to something sane for both native and target
-		CFLAGS="-O2 -pipe"
-
-		local VAR="CFLAGS_"${CTARGET//-/_}
-		CXXFLAGS=${!VAR}
-	fi
-
-	export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
-}
-
-toolchain_src_compile() {
-	multilib_env ${CTARGET}
-	gcc_do_filter_flags
-	einfo "CFLAGS=\"${CFLAGS}\""
-	einfo "CXXFLAGS=\"${CXXFLAGS}\""
+		GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
+	else
+		GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+	fi
 
-	# Force internal zip based jar script to avoid random
-	# issues with 3rd party jar implementations.  #384291
-	export JAR=no
+	# the gcc docs state that parallel make isnt supported for the
+	# profiledbootstrap target, as collisions in profile collecting may occur.
+	# boundschecking also seems to introduce parallel build issues.
+	if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ||
+	   use_if_iuse boundschecking
+	then
+		export MAKEOPTS="${MAKEOPTS} -j1"
+	fi
 
-	# 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
+	if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
+		STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
+	elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
+		# See bug #79852
+		STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
 	fi
-	# Build in a separate build tree
-	mkdir -p "${WORKDIR}"/build
-	pushd "${WORKDIR}"/build > /dev/null
 
-	einfo "Configuring ${PN} ..."
-	gcc_do_configure
+	if is_crosscompile; then
+		# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
+		# but I'll leave this in anyways as someone might have had
+		# some reason for putting it in here... --eradicator
+		BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
+	else
+		# we only want to use the system's CFLAGS if not building a
+		# cross-compiler.
+		BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS) ${CFLAGS}"}
+	fi
 
-	touch "${S}"/gcc/c-gperf.h
+	pushd "${WORKDIR}"/build
 
-	# Do not make manpages if we do not have perl ...
-	[[ ! -x /usr/bin/perl ]] \
-		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
+	emake \
+		LDFLAGS="${LDFLAGS}" \
+		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
+		LIBPATH="${LIBPATH}" \
+		BOOT_CFLAGS="${BOOT_CFLAGS}" \
+		${GCC_MAKE_TARGET} \
+		|| die "emake failed with ${GCC_MAKE_TARGET}"
 
-	einfo "Compiling ${PN} ..."
-	gcc_do_make ${GCC_MAKE_TARGET}
+	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
+		else
+			ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
+		fi
+	fi
 
 	popd > /dev/null
 }
 
-toolchain_src_test() {
+src_test() {
 	cd "${WORKDIR}"/build
 	emake -k check || ewarn "check failed and that sucks :("
 }
 
-toolchain_src_install() {
+src_install() {
 	local x=
 
 	cd "${WORKDIR}"/build
@@ -1604,210 +1751,10 @@ toolchain_src_install() {
 	fi
 }
 
-gcc_slot_java() {
-	local x
-
-	# Move Java headers to compiler-specific dir
-	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
-		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
-	done
-	for x in gcj gnu java javax org ; do
-		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
-			dodir /${LIBPATH}/include/${x}
-			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
-			rm -rf "${D}"${PREFIX}/include/${x}
-		fi
-	done
-
-	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
-		dodir /${LIBPATH}/security
-		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
-		rm -rf "${D}"${PREFIX}/lib*/security
-	fi
-
-	# Move random gcj files to compiler-specific directories
-	for x in libgcj.spec logging.properties ; do
-		x="${D}${PREFIX}/lib/${x}"
-		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
-	done
-
-	# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
-	for x in "${D}"${PREFIX}/lib*/pkgconfig/libgcj*.pc ; do
-		[[ -f ${x} ]] || continue
-		sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${x}"
-		mv "${x}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die
-	done
-
-	# Rename jar because it could clash with Kaffe's jar if this gcc is
-	# primary compiler (aka don't have the -<version> extension)
-	cd "${D}"${BINPATH}
-	[[ -f jar ]] && mv -f jar gcj-jar
-}
-
-# Move around the libs to the right location.  For some reason,
-# 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=""
-	for multiarg in $($(XGCC) -print-multi-lib) ; do
-		multiarg=${multiarg#*;}
-		multiarg=${multiarg//@/ -}
-
-		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
-		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
-		local TODIR=${D}${LIBPATH}/${MULTIDIR}
-		local FROMDIR=
-
-		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
-
-		for FROMDIR in \
-			${LIBPATH}/${OS_MULTIDIR} \
-			${LIBPATH}/../${MULTIDIR} \
-			${PREFIX}/lib/${OS_MULTIDIR} \
-			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
-		do
-			removedirs="${removedirs} ${FROMDIR}"
-			FROMDIR=${D}${FROMDIR}
-			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
-				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
-				if [[ -n ${files} ]] ; then
-					mv ${files} "${TODIR}"
-				fi
-			fi
-		done
-		fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
-	done
-
-	# We remove directories separately to avoid this case:
-	#	mv SRC/lib/../lib/*.o DEST
-	#	rmdir SRC/lib/../lib/
-	#	mv SRC/lib/../lib32/*.o DEST  # Bork
-	for FROMDIR in ${removedirs} ; do
-		rmdir "${D}"${FROMDIR} >& /dev/null
-	done
-	find "${D}" -type d | xargs rmdir >& /dev/null
-}
-
 #----<< src_* >>----
 
 #---->> unorganized crap in need of refactoring follows
 
-# gcc_quick_unpack will unpack the gcc tarball and patches in a way that is
-# consistant with the behavior of get_gcc_src_uri. The only patch it applies
-# itself is the branch update if present.
-#
-# Travis Tilley <lv@gentoo.org> (03 Sep 2004)
-#
-gcc_quick_unpack() {
-	pushd "${WORKDIR}" > /dev/null
-	export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
-	export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
-	export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
-	export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
-	export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
-
-	if [[ -n ${GCC_A_FAKEIT} ]] ; then
-		unpack ${GCC_A_FAKEIT}
-	elif [[ -n ${PRERELEASE} ]] ; then
-		unpack gcc-${PRERELEASE}.tar.bz2
-	elif [[ -n ${SNAPSHOT} ]] ; then
-		unpack gcc-${SNAPSHOT}.tar.bz2
-	elif [[ ${PV} != *9999* ]] ; then
-		unpack gcc-${GCC_RELEASE_VER}.tar.bz2
-		# We want branch updates to be against a release tarball
-		if [[ -n ${BRANCH_UPDATE} ]] ; then
-			pushd "${S}" > /dev/null
-			epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
-			popd > /dev/null
-		fi
-	fi
-
-	if [[ -n ${D_VER} ]] && use d ; then
-		pushd "${S}"/gcc > /dev/null
-		unpack gdc-${D_VER}-src.tar.bz2
-		cd ..
-		ebegin "Adding support for the D language"
-		./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
-		if ! eend $? ; then
-			eerror "The D gcc package failed to apply"
-			eerror "Please include this log file when posting a bug report:"
-			eerror "  ${T}/dgcc.log"
-			die "failed to include the D language"
-		fi
-		popd > /dev/null
-	fi
-
-	[[ -n ${PATCH_VER} ]] && \
-		unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
-
-	[[ -n ${UCLIBC_VER} ]] && \
-		unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
-
-	if want_pie ; then
-		if [[ -n ${PIE_CORE} ]] ; then
-			unpack ${PIE_CORE}
-		else
-			unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
-		fi
-		[[ -n ${SPECS_VER} ]] && \
-			unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
-	fi
-
-	use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
-
-	popd > /dev/null
-}
-
-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="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${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="Applying pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/
-	else
-		guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
-
-		# corrects startfile/endfile selection and shared/static/pie flag usage
-		EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/upstream
-		# adds non-default pie support (rs6000)
-		EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/nondef
-		# adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
-		EPATCH_MULTI_MSG="Applying default pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/def
-	fi
-	
-	# we want to be able to control the pie patch logic via something other
-	# than ALL_CFLAGS...
-	sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
-		-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
-		-i "${S}"/gcc/Makefile.in
-	# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
-	if tc_version_is_at_least 4.7.0 ; then
-		sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
-                        -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
-                        -i "${S}"/gcc/Makefile.in
-	fi
-
-	BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
-}
-
 should_we_gcc_config() {
 	# we always want to run gcc-config if we're bootstrapping, otherwise
 	# we might get stuck with the c-only stage1 compiler
@@ -2047,9 +1994,3 @@ is_treelang() {
 	#use treelang
 	return 0
 }
-
-# should kill these off once all the ebuilds are migrated
-gcc_pkg_setup() { toolchain_pkg_setup ; }
-gcc_src_unpack() { toolchain_src_unpack ; }
-gcc_src_compile() { toolchain_src_compile ; }
-gcc_src_test() { toolchain_src_test ; }

diff --git a/eclass/toolchain2.eclass b/eclass/toolchain2.eclass
index b5c0aa0..41c5ffb 100644
--- a/eclass/toolchain2.eclass
+++ b/eclass/toolchain2.eclass
@@ -1,8 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.532 2012/03/22 06:07:08 dirtyepic Exp $
-#
-# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
 
 #---->> eclass stuff <<----
 HOMEPAGE="http://gcc.gnu.org/"
@@ -11,7 +9,7 @@ RESTRICT="strip" # cross-compilers need controlled stripping
 
 inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails pax-utils
 
-if [[ ${PV} == *_pre9999* ]] ; then
+f [[ ${PV} == *_pre9999* ]] ; then
 	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
 	# naming style:
 	# gcc-4.7.1_pre9999 -> gcc-4_7-branch
@@ -23,13 +21,11 @@ if [[ ${PV} == *_pre9999* ]] ; then
 	inherit git-2
 fi
 
-EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
 DESCRIPTION="The GNU Compiler Collection"
-
 FEATURES=${FEATURES/multilib-strict/}
 #----<< eclass stuff >>----
 
-
 #---->> globals <<----
 export CTARGET=${CTARGET:-${CHOST}}
 if [[ ${CTARGET} = ${CHOST} ]] ; then
@@ -73,11 +69,8 @@ export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
 
 PREFIX=${TOOLCHAIN_PREFIX:-/usr}
 
-if tc_version_is_at_least 3.4.0 ; then
-	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
-else
-	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
-fi
+LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
+
 INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
 if is_crosscompile ; then
 	BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
@@ -91,9 +84,9 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
 
 #----<< globals >>----
 
-
 #---->> SLOT+IUSE logic <<----
-IUSE="build multislot nls nptl test vanilla"
+IUSE="build multislot nls nptl test vanilla bootstrap doc gcj gtk hardened multilib objc objc-gc mudflap"
+IUSE+=" objc++ openmp fixed-point graphite ito go"
 
 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
 	IUSE+=" altivec cxx fortran nocxx"
@@ -101,18 +94,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
 	[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
 	[[ -n ${D_VER}   ]] && IUSE+=" d"
 	[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
-
-	if tc_version_is_at_least 3 ; then
-		IUSE+=" bootstrap doc gcj gtk hardened multilib objc"
-
-		tc_version_is_at_least "4.0" && IUSE+=" objc-gc mudflap"
-		tc_version_is_at_least "4.1" && IUSE+=" libssp objc++"
-		tc_version_is_at_least "4.2" && IUSE+=" openmp"
-		tc_version_is_at_least "4.3" && IUSE+=" fixed-point"
-		tc_version_is_at_least "4.4" && IUSE+=" graphite"
-		[[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto"
-		tc_version_is_at_least "4.6" && IUSE+=" go"
-	fi
 fi
 
 # Support upgrade paths here or people get pissed
@@ -131,21 +112,12 @@ RDEPEND="sys-libs/zlib
 	!build? (
 		nls? ( sys-devel/gettext )
 	)"
-if tc_version_is_at_least 3 ; then
-	RDEPEND+=" virtual/libiconv"
-fi
-if tc_version_is_at_least 4 ; then
-	GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2"
-	if tc_version_is_at_least 4.3 ; then
-		RDEPEND+=" ${GMP_MPFR_DEPS}"
-	elif in_iuse fortran ; then
-		RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
-	fi
-	if tc_version_is_at_least 4.5 ; then
-		RDEPEND+=" >=dev-libs/mpc-0.8.1"
-	fi
-	in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
-fi
+RDEPEND+=" virtual/libiconv"
+RDEPEND+=" ${GMP_MPFR_DEPS}"
+in_iuse fortran && RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
+RDEPEND+=" >=dev-libs/mpc-0.8.1"
+in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
+
 if in_iuse graphite ; then
 	RDEPEND+="
 	    graphite? (
@@ -330,85 +302,6 @@ get_make_var() {
 }
 XGCC() { get_make_var GCC_FOR_TARGET ; }
 
-# 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 == "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, also if
-		# the loader doesn't actually load the resulting executables.
-		# To avoid breakage, blacklist FreeBSD here at least
-		[[ ${CTARGET} == *-freebsd* ]] && return 1
-
-		want_pie || return 1
-		use_if_iuse nopie && return 1
-		hardened_gcc_is_stable pie
-		return $?
-	elif [[ $1 == "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 == "pie" ]] ; then
-		if [[ ${CTARGET} == *-uclibc* ]] ; then
-			tocheck=${PIE_UCLIBC_STABLE}
-		else
-			tocheck=${PIE_GLIBC_STABLE}
-		fi
-	elif [[ $1 == "ssp" ]] ; then
-		if [[ ${CTARGET} == *-uclibc* ]] ; then
-			tocheck=${SSP_UCLIBC_STABLE}
-		else
-			tocheck=${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 nossp 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 f95, etc.
 #
@@ -420,41 +313,9 @@ gcc-lang-supported() {
 	has $1 ${TOOLCHAIN_ALLOWED_LANGS}
 }
 
-#----<< support checks >>----
-
+#----<< support checks >>---
 #---->> specs + env.d logic <<----
 
-# 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="-DEFAULT_RELRO -DEFAULT_BIND_NOW"
-
-	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 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 = /s|=|= ${gcc_hard_flags} |" \
-		"${S}"/gcc/Makefile.in || die
-
-	# rebrand to make bug reports easier
-	BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
-}
-
 create_gcc_env_entry() {
 	dodir /etc/env.d/gcc
 	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
@@ -502,49 +363,11 @@ create_gcc_env_entry() {
 	# Set which specs file to use
 	[[ -n ${gcc_specs_file} ]] && echo "GCC_SPECS=\"${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="${WORKDIR}"/build.specs
-}
-copy_minispecs_gcc_specs() {
-	# setup the hardenedno* specs files and the vanilla specs file.
-	if hardened_gcc_works ; then
-		create_gcc_env_entry hardenednopiessp
-	fi
-	if hardened_gcc_works pie ; then
-		create_gcc_env_entry hardenednopie
-	fi
-	if hardened_gcc_works ssp ; then
-		create_gcc_env_entry hardenednossp
-	fi
-	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 of
-	# specs as it completely and unconditionally overrides the builtin specs.
-	# 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 file"
-	fi
-}
 
 #----<< specs + env.d logic >>----
 
 #---->> pkg_* <<----
-toolchain_pkg_setup() {
+pkg_setup() {
 	if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
 	   [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]]
 	then
@@ -569,16 +392,15 @@ toolchain_pkg_setup() {
 		use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
 	fi
 
-	want_minispecs
 
 	unset LANGUAGES #265283
 }
 
-toolchain_pkg_preinst() {
+pkg_preinst() {
 	:
 }
 
-toolchain_pkg_postinst() {
+pkg_postinst() {
 	do_gcc_config
 
 	if ! is_crosscompile ; then
@@ -600,15 +422,6 @@ toolchain_pkg_postinst() {
 		ewarn "and this problem has been corrected in >=sys-devel/gcc-config-1.3.10-r1."
 	fi
 
-	if ! is_crosscompile && ! use multislot && [[ ${GCCMAJOR}.${GCCMINOR} == 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 ]] \
@@ -630,13 +443,13 @@ toolchain_pkg_postinst() {
 	fi
 }
 
-toolchain_pkg_prerm() {
+pkg_prerm() {
 	# Don't let these files be uninstalled #87647
 	touch -c "${ROOT}"/sbin/fix_libtool_files.sh \
 		"${ROOT}"/$(get_libdir)/rcscripts/awk/fixlafiles.awk
 }
 
-toolchain_pkg_postrm() {
+pkg_postrm() {
 	# to make our lives easier (and saner), we do the fix_libtool stuff here.
 	# rather than checking SLOT's and trying in upgrade paths, we just see if
 	# the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
@@ -713,7 +526,7 @@ do_gcc_rename_java_bins() {
 			die "Failed to fixup file ${jfile} for rename to grmic"
 	done
 }
-toolchain_src_unpack() {
+src_unpack() {
 	[[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
 
 	if [[ ${PV} == *9999* ]]; then
@@ -742,61 +555,31 @@ toolchain_src_unpack() {
 	do_gcc_PIE_patches
 	epatch_user
 
-	use hardened && make_gcc_hard
+	if use hardened ; then
+		BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
+	fi
 
 	# 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 =/s:=.*:= $(datadir)/python:' \
-			"${S}"/libstdc++-v3/python/Makefile.in || die
-	fi
+	sed -i \
+		'/^pythondir =/s:=.*:= $(datadir)/python:' \
+		"${S}"/libstdc++-v3/python/Makefile.in || die
 
-	# 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=""
-		for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
-			[[ -e ${x} ]] && fix_files="${fix_files} ${x}"
-		done
-		ht_fix_file ${fix_files} */configure *.sh */Makefile.in
-	fi
 
 	setup_multilib_osdirnames
 
 	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
-
-	# >= 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=14992
-	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
 
 	# Prevent libffi from being installed
@@ -812,7 +595,7 @@ toolchain_src_unpack() {
 	# update configure files
 	local f
 	einfo "Fixing misc issues in configure files"
-	tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
+	epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
 	for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
 		ebegin "  Updating ${f/${S}\/} [LANG]"
 		patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
@@ -865,12 +648,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+=" --with-multilib-list=${list:1}"
-			fi
+			 confgcc+=" --with-multilib-list=${list:1}"
 			;;
 		esac
 	fi
@@ -879,60 +657,45 @@ gcc-multilib-configure() {
 gcc-compiler-configure() {
 	gcc-multilib-configure
 
-	if tc_version_is_at_least "4.0" ; then
-		if in_iuse mudflap ; then
-			confgcc+=" $(use_enable mudflap libmudflap)"
-		else
-			confgcc+=" --disable-libmudflap"
-		fi
-
-		if use_if_iuse libssp ; then
-			confgcc+=" --enable-libssp"
-		else
-			export gcc_cv_libc_provides_ssp=yes
-			confgcc+=" --disable-libssp"
-		fi
-
-		# If we want hardened support with the newer piepatchset for >=gcc 4.4
-		if tc_version_is_at_least 4.4 && want_minispecs ; then
-			confgcc+=" $(use_enable hardened esp)"
-		fi
+	if in_iuse mudflap ; then
+		confgcc+=" $(use_enable mudflap libmudflap)"
+	else
+		confgcc+=" --disable-libmudflap"
+	fi
 
-		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 <pthread.h>" >& /dev/null
-				then
-					confgcc+=" $(use_enable openmp libgomp)"
-				else
-					# Force disable as the configure script can be dumb #359855
-					confgcc+=" --disable-libgomp"
-				fi
-			else
-				# For gcc variants where we don't want openmp (e.g. kgcc)
-				confgcc+=" --disable-libgomp"
-			fi
-		fi
+	# If we want hardened support (espf)
+	confgcc+=" $(use_enable hardened espf)"
 
-		# Stick the python scripts in their own slotted directory
-		# bug #279252
-		#
-		#  --with-python-dir=DIR
-		#  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-packages,
-		#  then --with-python-dir=/lib/python2.5/site-packages should be passed.
-		#
-		# This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
-		if tc_version_is_at_least "4.4" ; then
-			confgcc+=" --with-python-dir=${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 <pthread.h>" >& /dev/null
+			then
+				confgcc+=" $(use_enable openmp libgomp)"
+		else
+			# Force disable as the configure script can be dumb #359855
+			confgcc+=" --disable-libgomp"
 		fi
+	else
+		# For gcc variants where we don't want openmp (e.g. kgcc)
+		confgcc+=" --disable-libgomp"
 	fi
 
+	# Stick the python scripts in their own slotted directory
+	# bug #279252
+	#
+	#  --with-python-dir=DIR
+	#  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-packages,
+	#  then --with-python-dir=/lib/python2.5/site-packages should be passed.
+	#
+	# This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
+	confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python"
+
 	# 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
@@ -952,13 +715,13 @@ gcc-compiler-configure() {
 
 	# 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+=" --disable-build-with-cxx --disable-build-poststage1-with-cxx"
 	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
+	if ! is_fortran ; then
 		confgcc+=" --disable-libquadmath"
 	fi
 
@@ -978,8 +741,7 @@ gcc-compiler-configure() {
 
 			# Enable hardvfp
 			if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] && \
-			    tc_version_is_at_least "4.5" ; then
-			        confgcc+=" --with-float=hard"
+				confgcc+=" --with-float=hard"
 			fi
 			;;
 		# Add --with-abi flags to set default ABI
@@ -1016,9 +778,7 @@ gcc-compiler-configure() {
 	is_go  && GCC_LANG+=",go"
 	if is_objc || is_objcxx ; then
 		GCC_LANG+=",objc"
-		if tc_version_is_at_least "4.0" ; then
-			use objc-gc && confgcc+=" --enable-objc-gc"
-		fi
+		use objc-gc && confgcc+=" --enable-objc-gc"
 		is_objcxx && GCC_LANG+=",obj-c++"
 	fi
 	is_treelang && GCC_LANG+=",treelang"
@@ -1037,7 +797,7 @@ gcc-compiler-configure() {
 	confgcc+=" --enable-languages=${GCC_LANG}"
 }
 
-gcc_do_configure() {
+src_configure() {
 	local confgcc
 
 	# Sanity check for USE=nocxx -> USE=cxx migration
@@ -1082,7 +842,7 @@ gcc_do_configure() {
 	# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
 	# significantly increase compile time by several hours.  This will allow
 	# users to control this feature in the event they need the support.
-	tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
+	confgcc+=" $(use_enable fixed-point)"
 
 	# Graphite support was added in 4.4, which depends on external libraries
 	# for optimizations.  Current versions use cloog-ppl (cloog fork with Parma
@@ -1092,23 +852,17 @@ gcc_do_configure() {
 	# names are different).
 	#
 	# We disable the PPL version check so we can use >=ppl-0.11.
-	if tc_version_is_at_least "4.4"; then
-		confgcc+=" $(use_with graphite ppl)"
-		confgcc+=" $(use_with graphite cloog)"
-		if use graphite; then
-			confgcc+=" --disable-ppl-version-check"
-			confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
-		fi
+	confgcc+=" $(use_with graphite ppl)"
+	confgcc+=" $(use_with graphite cloog)"
+	if use graphite; then
+		confgcc+=" --disable-ppl-version-check"
+		confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
 	fi
 
 	# LTO support was added in 4.5, which depends upon elfutils.  This allows
 	# 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+=" --enable-lto"
-	elif tc_version_is_at_least "4.5" ; then
-		confgcc+=" $(use_enable lto)"
-	fi
+	confgcc+=" --enable-lto"
 
 	[[ $(tc-is-softfloat) == "yes" ]] && confgcc+=" --with-float=soft"
 	[[ $(tc-is-hardfloat) == "yes" ]] && confgcc+=" --with-float=hard"
@@ -1154,7 +908,7 @@ gcc_do_configure() {
 			fi
 		fi
 
-		tc_version_is_at_least 4.2 && confgcc+=" --disable-bootstrap"
+		confgcc+=" --disable-bootstrap"
 	else
 		if tc-is-static-only ; then
 			confgcc+=" --disable-shared"
@@ -1198,12 +952,12 @@ gcc_do_configure() {
 	# 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+=" --enable-targets=all" ;;
-	sparc)     tc_version_is_at_least 4.4 && confgcc+=" --enable-targets=all" ;;
-	amd64|x86) tc_version_is_at_least 4.3 && confgcc+=" --enable-targets=all" ;;
+	ppc|ppc64) confgcc+=" --enable-targets=all" ;;
+	sparc)     confgcc+=" --enable-targets=all" ;;
+	amd64|x86) confgcc+=" --enable-targets=all" ;;
 	esac
 
-	tc_version_is_at_least 4.3 && set -- "$@" \
+	set -- "$@" \
 		--with-bugurl=http://bugs.gentoo.org/ \
 		--with-pkgversion="${BRANDING_GCC_PKGVERSION}"
 	set -- ${confgcc} "$@" ${EXTRA_ECONF}
@@ -1230,6 +984,8 @@ gcc_do_configure() {
 
 	# return to whatever directory we were in before
 	popd > /dev/null
+
+	touch "${S}"/gcc/c-gperf.h
 }
 
 has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
@@ -1290,9 +1046,6 @@ gcc_do_make() {
 
 	if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
 		STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
-	elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
-		# See bug #79852
-		STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
 	fi
 
 	if is_crosscompile; then
@@ -1318,13 +1071,8 @@ gcc_do_make() {
 
 	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 doxygen installed"
 		fi
@@ -1348,31 +1096,7 @@ gcc_do_filter_flags() {
 	filter-flags '-mabi*' -m31 -m32 -m64
 
 	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=*' ;;
-			# 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=*";;
-		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-refs
-		filter-flags -f{no-,}stack-protector{,-all}
-		filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
-		;;
-	3.4|4.*)
+	4.*)
 		case $(tc-arch) in
 			x86|amd64) filter-flags '-mcpu=*';;
 			*-macos)
@@ -1415,9 +1139,8 @@ gcc_do_filter_flags() {
 
 	export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
 }
-
-toolchain_src_compile() {
-	multilib_env ${CTARGET}
+src_prepare() {
+		multilib_env ${CTARGET}
 	gcc_do_filter_flags
 	einfo "CFLAGS=\"${CFLAGS}\""
 	einfo "CXXFLAGS=\"${CXXFLAGS}\""
@@ -1426,18 +1149,11 @@ toolchain_src_compile() {
 	# issues with 3rd party jar implementations.  #384291
 	export JAR=no
 
-	# 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
-
-	einfo "Configuring ${PN} ..."
-	gcc_do_configure
-
+}
+src_compile() {
 	touch "${S}"/gcc/c-gperf.h
 
 	# Do not make manpages if we do not have perl ...
@@ -1450,12 +1166,12 @@ toolchain_src_compile() {
 	popd > /dev/null
 }
 
-toolchain_src_test() {
+src_test() {
 	cd "${WORKDIR}"/build
 	emake -k check || ewarn "check failed and that sucks :("
 }
 
-toolchain_src_install() {
+src_install() {
 	local x=
 
 	cd "${WORKDIR}"/build
@@ -1488,13 +1204,6 @@ toolchain_src_install() {
 	dodir /etc/env.d/gcc
 	create_gcc_env_entry
 
-	# Setup the gcc_env_entry for hardened gcc 4 with minispecs
-	if want_minispecs ; then
-		copy_minispecs_gcc_specs
-	fi
-	# Make sure we dont have stuff lying around that
-	# can nuke multiple versions of gcc
-
 	gcc_slot_java
 
 	# These should be symlinks
@@ -1565,12 +1274,8 @@ toolchain_src_install() {
 	# between binary and source package borks things ....
 	if ! is_crosscompile ; then
 		insinto "${DATAPATH}"
-		if tc_version_is_at_least 4.0 ; then
-			newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
-			find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
-		else
-			doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
-		fi
+		newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
+		find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
 		exeinto "${DATAPATH}"
 		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
 		doexe "${GCC_FILESDIR}"/c{89,99} || die
@@ -1598,10 +1303,9 @@ toolchain_src_install() {
 	export QA_WX_LOAD="usr/lib*/go/*/*.gox"
 
 	# 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}/cc1"
-		pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
-	fi
+	pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
+	pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
+
 }
 
 gcc_slot_java() {
@@ -1648,8 +1352,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=""
 	for multiarg in $($(XGCC) -print-multi-lib) ; do
@@ -1747,11 +1449,7 @@ gcc_quick_unpack() {
 		unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
 
 	if want_pie ; then
-		if [[ -n ${PIE_CORE} ]] ; then
-			unpack ${PIE_CORE}
-		else
-			unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
-		fi
+		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
@@ -1775,35 +1473,9 @@ do_gcc_PIE_patches() {
 
 	use vanilla && return 0
 
-	if tc_version_is_at_least 4.3.2; then
-		guess_patch_type_in_dir "${WORKDIR}"/piepatch/
-		EPATCH_MULTI_MSG="Applying pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/
-	else
-		guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
-
-		# corrects startfile/endfile selection and shared/static/pie flag usage
-		EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/upstream
-		# adds non-default pie support (rs6000)
-		EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/nondef
-		# adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
-		EPATCH_MULTI_MSG="Applying default pie patches ..." \
-		epatch "${WORKDIR}"/piepatch/def
-	fi
-	
-	# we want to be able to control the pie patch logic via something other
-	# than ALL_CFLAGS...
-	sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
-		-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
-		-i "${S}"/gcc/Makefile.in
-	# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
-	if tc_version_is_at_least 4.7.0 ; then
-		sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
-                        -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
-                        -i "${S}"/gcc/Makefile.in
-	fi
+	guess_patch_type_in_dir "${WORKDIR}"/piepatch/
+	EPATCH_MULTI_MSG="Applying pie patches ..." \
+	epatch "${WORKDIR}"/piepatch/
 
 	BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
 }
@@ -1882,25 +1554,9 @@ do_gcc_config() {
 	gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs}
 }
 
-# This function allows us to gentoo-ize gcc's version number and bugzilla
-# 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=${GCC_CONFIG_VER}
-	[[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
-
-	einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
-
-	local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
-	if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
-		gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" )
-	else
-		version_string="${version_string} (${BRANDING_GCC_PKGVERSION})"
-		gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" )
-	fi
-	sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
 }
 
 # This is a historical wart.  The original Gentoo/amd64 port used:
@@ -2047,9 +1703,3 @@ is_treelang() {
 	#use treelang
 	return 0
 }
-
-# should kill these off once all the ebuilds are migrated
-gcc_pkg_setup() { toolchain_pkg_setup ; }
-gcc_src_unpack() { toolchain_src_unpack ; }
-gcc_src_compile() { toolchain_src_compile ; }
-gcc_src_test() { toolchain_src_test ; }

diff --git a/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild b/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
index b6b5078..bf2c159 100644
--- a/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
+++ b/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
@@ -1,30 +1,20 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.6.2.ebuild,v 1.9 2012/03/15 20:21:44 vapier Exp $
-
 EAPI=4
 
-PATCH_VER="1.4"
-
-inherit toolchain2
+#PATCH_VER="1.4"
 
-DESCRIPTION="The GNU Compiler Collection"
+inherit toolchain
 
-LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
 KEYWORDS=""
 
 RDEPEND=""
 DEPEND="${RDEPEND}
-	elibc_glibc? ( >=sys-libs/glibc-2.8 )
+	elibc_glibc? ( >=sys-libs/glibc-2.12 )
 	amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )
 	>=${CATEGORY}/binutils-2.18"
 
 if [[ ${CATEGORY} != cross-* ]] ; then
-	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
+	PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.12 )"
 fi
-
-#src_unpack() {
-#
-#	[[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
-#}
-



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-07 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-29 23:26 [gentoo-commits] proj/hardened-dev:testing commit in: sys-devel/gcc/, eclass/ Magnus Granberg
  -- strict thread matches above, loose matches on Subject: below --
2012-10-07 16:44 Magnus Granberg
2012-08-01 18:37 Magnus Granberg
2012-04-07 19:11 Magnus Granberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox