--- flag-o-matic.eclass.orig 2005-04-27 19:46:05.000000000 +0200 +++ flag-o-matic.eclass 2005-04-28 21:20:35.000000000 +0200 @@ -63,6 +63,18 @@ # notice: modern automatic specs files will also suppress -fstack-protector-all # when only -fno-stack-protector is given # +#### has_pic #### +# Returns true if the compiler by default or with current CFLAGS +# builds position-independent code. +# +#### has_ssp_all #### +# Returns true if the compiler by default or with current CFLAGS +# generates stack smash protections for all functions +# +#### has_ssp #### +# Returns true if the compiler by default or with current CFLAGS +# generates stack smash protections for most vulnerable functions +# # C[XX]FLAGS that we allow in strip-flags setup-allowed-flags() { @@ -326,7 +338,6 @@ [ "${CFLAGS/-fPIC}" != "${CFLAGS}" ] && return 0 [ "${CFLAGS/-fpic}" != "${CFLAGS}" ] && return 0 [ "$(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __PIC__)" ] && return 0 - test_version_info pie && return 0 return 1 } @@ -340,6 +351,14 @@ return 1 } +# indicate whether code for SSP is being generated for all functions +has_ssp_all() { + # note; this matches only -fstack-protector-all + [ "${CFLAGS/-fstack-protector-all}" != "${CFLAGS}" ] && return 0 + [ "$(echo | $(tc-getCC) ${CFLAGS} -E -dM - | grep __SSP_ALL__)" ] && return 0 + return 1 +} + # indicate whether code for SSP is being generated has_ssp() { # note; this matches both -fstack-protector and -fstack-protector-all