summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZorry <zorry.at.ume.nu>2009-03-23 22:42:33 +0100
committerZorry <zorry.at.ume.nu>2009-03-23 22:42:33 +0100
commit5b148f4d851bff417c406427fe07bf2d3e993a57 (patch)
tree9c847f31fdd29cacf8a6649a927504226c9d57cf
parentUpdated sys-libs/libstdc++-v3 Ticket #64 (diff)
downloadhardened-dev-5b148f4d851bff417c406427fe07bf2d3e993a57.tar.gz
hardened-dev-5b148f4d851bff417c406427fe07bf2d3e993a57.tar.bz2
hardened-dev-5b148f4d851bff417c406427fe07bf2d3e993a57.zip
Updated the eclass files to follow portage
-rw-r--r--eclass/flag-o-matic.eclass9
-rw-r--r--eclass/hardened-funcs.eclass22
-rw-r--r--eclass/toolchain-funcs.eclass15
-rw-r--r--eclass/toolchain.eclass50
4 files changed, 59 insertions, 37 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 82b110c3..62f39fcf 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.127 2008/12/21 21:40:49 solar Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.132 2009/01/21 00:42:20 gengor Exp $
# @ECLASS: flag-o-matic.eclass
# @MAINTAINER:
@@ -15,9 +15,8 @@ ___ECLASS_RECUR_FLAG_O_MATIC="yes"
[[ -z ${___ECLASS_RECUR_HARDENED_FUNCS} ]] && inherit hardened-funcs
################ DEPRECATED functions ################
-# The following are still present to avoid breaking existing
-# code more than necessary; however they are deprecated. Please
-# use gcc-specs-* from toolchain-funcs.eclass instead, if you
+# The following are removed and use gcc-specs-*
+# from toolchain-funcs.eclass instead, if you
# need to know which hardened techs are active in the compiler.
# See bug #100974
#
@@ -156,7 +155,7 @@ _raw_append_flag() {
# Add extra <flags> to your current {C,CXX,F,FC}FLAGS.
# Call _append_flag in hardened-funcs. Check flag for
# -fno-stack-protector-all and if not call _raw_append_flag.
-# GCC >4.1 don't support -fno-stack-protector
+# GCC >4.1 don't support -fno-stack-protector-all
append-flags() {
local f
[[ -z "$@" ]] && return 0
diff --git a/eclass/hardened-funcs.eclass b/eclass/hardened-funcs.eclass
index b8da74b8..6d9aebb8 100644
--- a/eclass/hardened-funcs.eclass
+++ b/eclass/hardened-funcs.eclass
@@ -2,7 +2,7 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/hardened-funcs.eclass,v 1.0 2008/12/22 09:20:34 zorry Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/hardened-funcs.eclass,v 1.001 2009/03/23 21:38:00 zorry Exp $
#
# Maintainer: Hardened Ninjas <hardened@gentoo.org>
@@ -14,12 +14,12 @@ ___ECLASS_RECUR_HARDENED_FUNCS="yes"
# Internal function for _filter-hardened
# _manage_hardened <flag being filtered> <cflag to use>
_manage-hardened() {
- [[ -z $2 ]] && die "Internal hardened-funcs error - please report"
- if test-flags "$2" > /dev/null ; then
+ [[ -z $1 ]] && die "Internal hardened-funcs error - please report"
+ if test-flags "$1" > /dev/null ; then
elog "Hardened compiler will filter some flags"
- _raw_append_flag $2
+ _raw_append_flag $1
else
- die "Compiler do not support $2"
+ die "Compiler do not support $1"
fi
}
@@ -33,15 +33,15 @@ _filter-hardened() {
# not -fPIC or -fpic, but too many places filter -fPIC without
# thinking about -fPIE.
-fPIC|-fpic|-fPIE|-fpie|-Wl,pie|-pie)
- gcc-specs-pie && _manage-hardened "$f" -nopie ;;
+ gcc-specs-pie && _manage-hardened -nopie ;;
-fstack-protector)
- gcc-specs-ssp && _manage-hardened "$f" -fno-stack-protector ;;
+ gcc-specs-ssp && _manage-hardened -fno-stack-protector ;;
-fstack-protector-all)
- gcc-specs-ssp-to-all && _manage-hardened "$f" -fno-stack-protector-all ;;
+ gcc-specs-ssp-to-all && _manage-hardened -fno-stack-protector-all ;;
-D_FORTIFY_SOURCE=2|-D_FORTIFY_SOURCE=1|-D_FORTIFY_SOURCE=0)
- gcc-specs-fortify && _manage-hardened "$f" -U_FORTIFY_SOURCE ;;
+ gcc-specs-fortify && _manage-hardened -U_FORTIFY_SOURCE ;;
-fno-strict-overflow)
- gcc-specs-strict && _manage-hardened "$f" -fstrict-overflow ;;
+ gcc-specs-strict && _manage-hardened -fstrict-overflow ;;
esac
done
}
@@ -52,7 +52,7 @@ _append-flag() {
case "$1" in
-fno-stack-protector-all)
gcc-specs-ssp-to-all || continue
- _manage-hardened -fstack-protector-all "$1" ;;
+ _manage-hardened -fno-stack-protector-all ;;
*)
_raw_append_flag "$1"
esac
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 6b65b211..aef811fd 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.79 2008/09/16 06:40:21 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.87 2009/03/01 08:09:44 vapier Exp $
# @ECLASS: toolchain-funcs.eclass
# @MAINTAINER:
@@ -72,6 +72,10 @@ tc-getNM() { tc-getPROG NM nm "$@"; }
# @USAGE: [toolchain prefix]
# @RETURN: name of the archiver indexer
tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; }
+# @FUNCTION: tc-getOBJCOPY
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the object copier
+tc-getOBJCOPY() { tc-getPROG OBJCOPY objcopy "$@"; }
# @FUNCTION: tc-getF77
# @USAGE: [toolchain prefix]
# @RETURN: name of the Fortran 77 compiler
@@ -436,10 +440,11 @@ gen_usr_ldscript() {
fi
cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
/* GNU ld script
- Since Gentoo has critical dynamic libraries
- in /lib, and the static versions in /usr/lib,
- we need to have a "fake" dynamic lib in /usr/lib,
- otherwise we run into linking problems.
+ Since Gentoo has critical dynamic libraries in /lib, and the static versions
+ in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
+ run into linking problems. This "fake" dynamic lib is a linker script that
+ redirects the linker to the real lib. And yes, this works in the cross-
+ compiling scenario as the sysroot-ed linker will prepend the real path.
See bug http://bugs.gentoo.org/4411 for more info.
*/
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 648d6cfb..5adbc01f 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.368 2008/12/22 18:53:47 solar Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.395 2009/03/15 07:13:25 vapier Exp $
#
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
@@ -583,26 +583,26 @@ do_gcc_rename_java_bins() {
# 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
+ 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} ||
+ 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} ||
+ 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} ||
+ 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} ||
+ sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} ||
die "Failed to fixup file ${jfile} for rename to grmic"
done
}
@@ -675,10 +675,7 @@ gcc_src_unpack() {
# 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 [[ ${GCCMAJOR} < 3 ]] || \
- [[ ${GCCMAJOR}.${GCCMINOR} < 3.4 ]] || \
- [[ ${GCCMAJOR}.${GCCMINOR}.${GCCMICRO} < 3.4.4 ]]
- then
+ 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
@@ -699,7 +696,7 @@ gcc_src_unpack() {
# update configure files
local f
einfo "Fixing misc issues in configure files"
- [[ ${GCCMAJOR} -ge 4 ]] && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
+ 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 \
@@ -924,7 +921,9 @@ gcc_do_configure() {
if [[ ${CTARGET} == *-uclibc* ]] ; then
confgcc="${confgcc} --disable-__cxa_atexit --enable-target-optspace"
[[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc="${confgcc} --enable-sjlj-exceptions"
- [[ ${GCCMAJOR}.${GCCMINOR} > 3.3 ]] && confgcc="${confgcc} --enable-clocale=uclibc"
+ if tc_version_is_at_least 3.4 && [[ ${GCCMAJOR}.${GCCMINOR} < 4.3 ]] ; then
+ confgcc="${confgcc} --enable-clocale=uclibc"
+ fi
elif [[ ${CTARGET} == *-gnu* ]] ; then
confgcc="${confgcc} --enable-__cxa_atexit"
confgcc="${confgcc} --enable-clocale=gnu"
@@ -1105,12 +1104,30 @@ gcc_do_filter_flags() {
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
- x86) filter-flags '-mtune=*';;
- amd64) filter-flags '-mtune=*'
- replace-cpu-flags k8 athlon64 opteron i686;;
+ 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=*';;
@@ -1483,7 +1500,7 @@ gcc_quick_unpack() {
# 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
+ epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
popd > /dev/null
fi
fi
@@ -1782,6 +1799,7 @@ is_ada() {
}
is_treelang() {
+ has boundschecking ${IUSE} && use boundschecking && return 1 #260532
is_crosscompile && return 1 #199924
gcc-lang-supported treelang || return 1
#use treelang