| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.116 2007/03/04 21:03:59 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.117 2007/03/04 21:13:17 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # Maintainer: toolchain@gentoo.org |
5 | # Maintainer: toolchain@gentoo.org |
| 6 | |
6 | |
| 7 | # need access to emktemp() |
7 | # need access to emktemp() |
| 8 | inherit eutils toolchain-funcs multilib |
8 | inherit eutils toolchain-funcs multilib |
| … | |
… | |
| 90 | # Returns true if the compiler by default or with current CFLAGS |
90 | # Returns true if the compiler by default or with current CFLAGS |
| 91 | # generates stack smash protections for most vulnerable functions |
91 | # generates stack smash protections for most vulnerable functions |
| 92 | # |
92 | # |
| 93 | |
93 | |
| 94 | # C[XX]FLAGS that we allow in strip-flags |
94 | # C[XX]FLAGS that we allow in strip-flags |
|
|
95 | # Note: shell globs and character lists are allowed |
| 95 | setup-allowed-flags() { |
96 | setup-allowed-flags() { |
| 96 | if [[ -z ${ALLOWED_FLAGS} ]] ; then |
97 | if [[ -z ${ALLOWED_FLAGS} ]] ; then |
| 97 | export ALLOWED_FLAGS="-pipe" |
98 | export ALLOWED_FLAGS="-pipe" |
| 98 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" |
99 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -O -O0 -O1 -O2 -mcpu -march -mtune" |
| 99 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all" |
100 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fstack-protector -fstack-protector-all" |
| 100 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-bounds-checking" |
101 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fbounds-checking -fno-bounds-checking" |
| 101 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time" |
102 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-PIE -fno-pie -fno-unit-at-a-time" |
| 102 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g0 -g1 -g2 -g3 -ggdb -ggdb0 -ggdb1 -ggdb2 -ggdb3" |
103 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -g -g[0-9] -ggdb -ggdb[0-9] -gstabs -gstabs+" |
| 103 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-ident" |
104 | export ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-ident" |
| 104 | fi |
105 | fi |
| 105 | # allow a bunch of flags that negate features / control ABI |
106 | # allow a bunch of flags that negate features / control ABI |
| 106 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" |
107 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -fno-stack-protector -fno-stack-protector-all" |
| 107 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \ |
108 | ALLOWED_FLAGS="${ALLOWED_FLAGS} -mregparm -mno-app-regs -mapp-regs \ |