summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorNed Ludd <solar@gentoo.org>2003-09-24 05:51:32 +0000
committerNed Ludd <solar@gentoo.org>2003-09-24 05:51:32 +0000
commited3ac1b143c9ae035725bf624dc7cf62e4924833 (patch)
tree5b803814c32476c0880827ed665b1f09c01fb8c7 /eclass
parentinstall all the manpages (diff)
downloadgentoo-2-ed3ac1b143c9ae035725bf624dc7cf62e4924833.tar.gz
gentoo-2-ed3ac1b143c9ae035725bf624dc7cf62e4924833.tar.bz2
gentoo-2-ed3ac1b143c9ae035725bf624dc7cf62e4924833.zip
required hardened-gcc hooks for fPIC and propolice
Diffstat (limited to 'eclass')
-rw-r--r--eclass/flag-o-matic.eclass48
1 files changed, 47 insertions, 1 deletions
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 1304091d0548..c412b2ce0abe 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.26 2003/09/15 15:21:04 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.27 2003/09/24 05:51:32 solar Exp $
#
# Author Bart Verwilst <verwilst@gentoo.org>
@@ -37,6 +37,20 @@ INHERITED="$INHERITED $ECLASS"
# Remove specified math types from the fpmath specification
# If the user has -mfpmath=sse,386, running `filter-mfpmath sse`
# will leave the user with -mfpmath=386
+#
+#### append-ldflags ####
+# Add extra flags to your current LDFLAGS
+#
+#### etexec-flags ####
+# hooked function for hardened-gcc that appends
+# -yet_exec {C,CXX,LD}FLAGS when hardened-gcc is installed
+# and a package is filtering -fPIC
+#
+#### fstack-flags ####
+# hooked function for hardened-gcc that appends
+# -yno_propolice to {C,CXX,LD}FLAGS when hardened-gcc is installed
+# and a package is filtering -fstack-protector
+#
# C[XX]FLAGS that we allow in strip-flags
ALLOWED_FLAGS="-O -O1 -O2 -mcpu -march -mtune -fstack-protector -pipe -g"
@@ -71,6 +85,14 @@ filter-mfpmath() {
}
filter-flags() {
+ # we do two loops to avoid the first and last char from being chomped.
+ for x in $@ ; do
+ case "${x}" in
+ -fPIC) etexec-flags;;
+ -fstack-protector) fstack-flags;;
+ *) ;;
+ esac
+ done
# we do this fancy spacing stuff so as to not filter
# out part of a flag ... we want flag atoms ! :D
CFLAGS=" ${CFLAGS} "
@@ -86,6 +108,10 @@ filter-flags() {
append-flags() {
CFLAGS="${CFLAGS} $@"
CXXFLAGS="${CXXFLAGS} $@"
+ for x in $@; do
+ [ "${x}" = "-fno-stack-protector" ] &&
+ fstack-flags
+ done
}
replace-flags() {
@@ -191,3 +217,23 @@ replace-sparc64-flags() {
done
fi
}
+
+append-ldflags() {
+ LDFLAGS="${LDFLAGS} $@"
+}
+
+etexec-flags() {
+ has_version 'sys-devel/hardened-gcc' && {
+ debug-print ">>> appending flags -yet_exec"
+ append-flags -yet_exec
+ append-ldflags -yet_exec
+ }
+}
+
+fstack-flags() {
+ has_version 'sys-devel/hardened-gcc' && {
+ debug-print ">>> appending flags -yno_propolice"
+ append-flags -yno_propolice
+ append-ldflags -yno_propolice
+ }
+}