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.eclass43
1 files changed, 24 insertions, 19 deletions
diff --git a/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass b/hardened/toolchain/branches/pieworld/eclass/flag-o-matic.eclass
index a5f0103..229b30a 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.118 2007/03/24 07:07:18 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.119 2007/05/12 11:45:51 vapier Exp $
#
# Maintainer: toolchain@gentoo.org
@@ -94,18 +94,20 @@ inherit eutils toolchain-funcs multilib
# C[XX]FLAGS that we allow in strip-flags
# Note: shell globs and character lists are allowed
setup-allowed-flags() {
- if [[ -z ${ALLOWED_FLAGS} ]] ; then
- export ALLOWED_FLAGS="-pipe"
- export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune"
- export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all"
- export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-bounds-checking"
- export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time"
- export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g[0-9] -ggdb -ggdb[0-9] -gstabs -gstabs+"
- export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-ident"
- fi
- # allow a bunch of flags that negate features / control ABI
- ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all"
- ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \
+ # Default set of allowed flags - ebuilds may override this set
+ # by setting ALLOWED_FLAGS.
+ [[ -z ${ALLOWED_FLAGS} ]] &&
+ ALLOWED_FLAGS="-pipe -O -O0 -O1 -O2 -mcpu -march -mtune \
+ -fstack-protector -fstack-protector-all -fbounds-checking \
+ -g -g[0-9] -ggdb -ggdb[0-9] -gstabs -gstabs+ \
+ -fno-unit-at-a-time -fno-ident"
+ # allow a bunch of flags that negate features / control ABI - these
+ # are always allowed.
+ # ? Why is -fPIC here? It should be covered by -m<something> where
+ # necessary. Setting -fPIC in C[XX]FLAGS isn't sensible, in general.
+ ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-bounds-checking \
+ -fno-stack-protector-all -fno-stack-protector \
+ -mregparm -mno-app-regs -mapp-regs \
-mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow \
-mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 \
-msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu \
@@ -115,6 +117,7 @@ setup-allowed-flags() {
-m32 -m64 -mabi -mlittle-endian -mbig-endian -EL -EB -fPIC \
-mlive-g0 -mcmodel -mstack-bias -mno-stack-bias \
-msecure-plt -D*"
+ export ALLOWED_FLAGS
# C[XX]FLAGS that we are think is ok, but needs testing
# NOTE: currently -Os have issues with gcc3 and K6* arch's
@@ -123,7 +126,7 @@ setup-allowed-flags() {
}
# Return true if the HFILTER_CONTROL permits the requested filter
-# _hfilterok <category/pf> <pie|ssp|relro|now>
+# _hfilter_allowed <category/pf> <pie|ssp|relro|now>
_hfilter_allowed() {
[[ -z ${HFILTER_CONTROL} ]] && return 0
[[ $(awk -v CPF="$1" -v TYPE="$2" 'BEGIN { ok=0 }
@@ -139,14 +142,14 @@ _manage-hardened() {
[[ -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}"
+ ewarn "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"
- einfo "Hardened compiler filtered $1 - GCC_SPECS set to ${GCC_SPECS}"
+ elog "Hardened compiler filtered $1 - GCC_SPECS set to ${GCC_SPECS}"
else
local oldspec=${GCC_SPECS/*\/} newspec=""
case $2 in
@@ -175,13 +178,15 @@ _manage-hardened() {
if [[ -n ${newspec} ]]; then
if _gcc-specs-exists ${newspec}; then
export GCC_SPECS="${newspec}"
- einfo "Hardened compiler filtered $1 - GCC_SPECS set to ${GCC_SPECS}"
+ elog "Hardened compiler filtered $1 - GCC_SPECS set to ${GCC_SPECS}"
else
- die "Internal flag-o-matic error ($*) - please report"
+ # This can happen if the compiler is not built with split-specs
+ #die "Internal flag-o-matic error ($*) - please report"
+ ewarn "Hardened compiler filter $1 requested by ebuild - ignored since neither $2 nor ${newspec} exist"
fi
else
_raw_append_flag $3
- einfo "Hardened compiler filtered $1 - CFLAGS set to ${CFLAGS}"
+ elog "Hardened compiler filtered $1 - CFLAGS set to ${CFLAGS}"
fi
fi
}