summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass')
-rw-r--r--hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass27
1 files changed, 25 insertions, 2 deletions
diff --git a/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass b/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass
index 41fad08..a5f0103 100644
--- a/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass
+++ b/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.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/flag-o-matic.eclass,v 1.117 2007/03/04 21:13:17 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.118 2007/03/24 07:07:18 vapier Exp $
#
# Maintainer: toolchain@gentoo.org
@@ -122,11 +122,27 @@ setup-allowed-flags() {
return 0
}
+# Return true if the HFILTER_CONTROL permits the requested filter
+# _hfilterok <category/pf> <pie|ssp|relro|now>
+_hfilter_allowed() {
+ [[ -z ${HFILTER_CONTROL} ]] && return 0
+ [[ $(awk -v CPF="$1" -v TYPE="$2" 'BEGIN { ok=0 }
+$1=="allow" && CPF~$2 && TYPE==$3 { ok=0 }
+$1=="deny" && CPF~$2 && TYPE==$3 { ok=1 }
+END { print ok }' ${HFILTER_CONTROL}) == 0 ]]
+}
+
# Internal function for _filter-hardened
# _manage_hardened <flag being filtered> <minispec to use> <cflag to use>
_manage-hardened() {
local filter=$1 newspec=$2
[[ -z $3 ]] && die "Internal flag-o-matic error ($*) - please report"
+
+ if ! $(_hfilter_allowed ${CATEGORY}/${PF} ${newspec/no}); then
+ einfo "Hardened compiler filter $1 requested by ebuild - ignored by request in ${HFILTER_CONTROL}"
+ return 0
+ fi
+
if _gcc-specs-exists ${newspec}.specs; then
[[ -z ${GCC_SPECS} ]] || newspec=":${newspec}"
export GCC_SPECS="${GCC_SPECS}${newspec}.specs"
@@ -221,6 +237,7 @@ _filter-var() {
filter-flags() {
_filter-hardened "$@"
_filter-var CFLAGS "$@"
+ _filter-var CPPFLAGS "$@"
_filter-var CXXFLAGS "$@"
return 0
}
@@ -230,9 +247,15 @@ filter-lfs-flags() {
filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
}
+append-cppflags() {
+ [[ -z $* ]] && return 0
+ export CPPFLAGS="${CPPFLAGS} $*"
+ return 0
+}
+
append-lfs-flags() {
[[ -n $@ ]] && die "append-lfs-flags takes no arguments"
- append-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+ append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
}
# Append flag if the compiler doesn't barf it