aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2012-04-08 01:58:20 +0200
committerMagnus Granberg <zorry@gentoo.org>2012-04-08 01:58:20 +0200
commite55e38c40d8f9d8b44f9335a4f1c1e0016227534 (patch)
treea5b3401e136b39081ddcfd2300323a1c6db53bef
parentUpdated the README (diff)
downloadhardened-dev-e55e38c40d8f9d8b44f9335a4f1c1e0016227534.tar.gz
hardened-dev-e55e38c40d8f9d8b44f9335a4f1c1e0016227534.tar.bz2
hardened-dev-e55e38c40d8f9d8b44f9335a4f1c1e0016227534.zip
remove alot of <gcc-4.6 support
-rw-r--r--eclass/toolchain.eclass615
1 files changed, 111 insertions, 504 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index aa00f096..9f872257 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -71,11 +71,7 @@ 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}}
@@ -98,18 +94,9 @@ 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
+ IUSE+=" bootstrap doc gcj gtk hardened multilib objc"
+ IUSE+=" objc-gc mudflap objc++ openmp fixed-point graphite go"
+ [[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto"
fi
# Support upgrade paths here or people get pissed
@@ -128,21 +115,11 @@ 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+=" >=dev-libs/mpc-0.8.1"
+GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2"
+RDEPEND+=" ${GMP_MPFR_DEPS}"
+in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
if in_iuse graphite ; then
RDEPEND+="
graphite? (
@@ -167,9 +144,9 @@ if in_iuse gcj ; then
x11-proto/xproto
x11-proto/xextproto
=x11-libs/gtk+-2*"
- tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango"
+ GCJ_GTK_DEPS+=" x11-libs/pango"
GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
- tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip"
+ GCJ_DEPS+=" app-arch/zip app-arch/unzip"
DEPEND+=" gcj? ( gtk? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
fi
@@ -301,14 +278,8 @@ get_gcc_src_uri() {
[[ -n ${D_VER} ]] && GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
- # >= gcc-4.3 uses ecj.jar and we only add gcj as a use flag under certain
- # conditions
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
- if tc_version_is_at_least "4.5" ; then
- GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
- elif tc_version_is_at_least "4.3" ; then
- GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )"
- fi
+ GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
fi
echo "${GCC_SRC_URI}"
@@ -326,85 +297,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,37 +312,6 @@ gcc-lang-supported() {
#---->> 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}"
@@ -498,21 +359,6 @@ 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
@@ -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 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 >>----
@@ -560,8 +398,6 @@ pkg_setup() {
use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
fi
- want_minispecs
-
unset LANGUAGES #265283
}
@@ -583,23 +419,6 @@ pkg_postinst() {
echo
fi
- # 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 '>=sys-devel/gcc-config-1.3.10-r1' && [[ ${GCC_CONFIG_VER/-/} != ${GCC_CONFIG_VER} ]] ; then
- ewarn "Your version of gcc-config will issue about having an invalid profile"
- ewarn "when switching to this profile. It is safe to ignore this warning,"
- 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 ]] \
@@ -670,40 +489,6 @@ guess_patch_type_in_dir() {
&& EPATCH_SUFFIX="patch.bz2" \
|| EPATCH_SUFFIX="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 grmiregistry."
- # 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 gcc/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=()
@@ -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+=" --with-multilib-list=${list:1}"
- fi
+ confgcc+=" --with-multilib-list=${list:1}"
;;
esac
fi
@@ -749,68 +529,47 @@ 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
+ 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
- confgcc+=" --enable-checking=${GCC_CHECKS_LIST:-release}"
- else
- confgcc+=" --disable-checking"
- fi
-
+ confgcc+=" --enable-checking=${GCC_CHECKS_LIST:-release}"
+
# GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained
# right now). Much thanks to <csm@gnu.org> for the heads up.
# Travis Tilley <lv@gentoo.org> (11 Jul 2004)
@@ -822,13 +581,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
@@ -847,8 +606,7 @@ gcc-compiler-configure() {
fi
# Enable hardvfp
- if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] && \
- tc_version_is_at_least "4.5" ; then
+ if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] ; then
confgcc+=" --with-float=hard"
fi
;;
@@ -886,9 +644,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"
@@ -930,31 +686,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)
@@ -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=""
for multiarg in $($(XGCC) -print-multi-lib) ; do
multiarg=${multiarg#*;}
@@ -1084,58 +813,12 @@ gcc_movelibs() {
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"
+ [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && \
+ die "Sorry, this version does not support uClibc"
if [[ ${PV} == *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
- 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
use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
@@ -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="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${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="Applying pie patches ..." \
+ epatch "${WORKDIR}"/piepatch/
+ BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
+ fi
epatch_user
- use hardened && make_gcc_hard
+ if use_if_iuse 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
-
- # 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
-
+ sed -i \
+ '/^pythondir =/s:=.*:= $(datadir)/python:' \
+ "${S}"/libstdc++-v3/python/Makefile.in || die
+
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
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
@@ -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-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 \
@@ -1318,11 +979,6 @@ src_configure() {
# 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
@@ -1371,7 +1027,7 @@ src_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
@@ -1381,24 +1037,18 @@ src_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"
@@ -1443,7 +1093,7 @@ src_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"
@@ -1462,10 +1112,6 @@ src_configure() {
case ${CTARGET} in
*-uclibc*)
confgcc+=" --disable-__cxa_atexit --enable-target-optspace $(use_enable nptl tls)"
- [[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc+=" --enable-sjlj-exceptions"
- if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then
- confgcc+=" --enable-clocale=uclibc"
- fi
;;
*-elf|*-eabi)
confgcc+=" --with-newlib"
@@ -1481,18 +1127,17 @@ src_configure() {
confgcc+=" --enable-__cxa_atexit"
;;
esac
- tc_version_is_at_least 3.4 || confgcc+=" --disable-libunwind-exceptions"
-
+
# 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+=" --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}
@@ -1554,9 +1199,6 @@ src_compile() {
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
@@ -1582,13 +1224,8 @@ src_compile() {
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
@@ -1636,9 +1273,9 @@ src_install() {
create_gcc_env_entry
# 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
@@ -1745,10 +1382,8 @@ 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"
}
#----<< src_* >>----
@@ -1829,27 +1464,6 @@ 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:
# lib32 - 32bit binaries (x86)
# lib64 - 64bit binaries (x86_64)
@@ -1883,13 +1497,7 @@ setup_multilib_osdirnames() {
if [[ ${SYMLINK_LIB} == "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:=.*:= ${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() {
}
is_multilib() {
- tc_version_is_at_least 3 || return 1
use multilib
}