diff options
author | Repository QA checks <repo-qa-checks@gentoo.org> | 2017-06-16 09:58:33 +0000 |
---|---|---|
committer | Repository QA checks <repo-qa-checks@gentoo.org> | 2017-06-16 09:58:33 +0000 |
commit | 4ec36e5b11e4f1206bd3b45caeedfcc2a6dbb4f5 (patch) | |
tree | dec786fdf5904170df7ead0f460f6309e6b9e436 /eclass/toolchain-funcs.eclass | |
parent | 2017-06-16 08:31:23 UTC (diff) | |
parent | eclass/toolchain-glibc.eclass: skip pie check for gcc-6 or newer (diff) | |
download | gentoo-4ec36e5b11e4f1206bd3b45caeedfcc2a6dbb4f5.tar.gz gentoo-4ec36e5b11e4f1206bd3b45caeedfcc2a6dbb4f5.tar.bz2 gentoo-4ec36e5b11e4f1206bd3b45caeedfcc2a6dbb4f5.zip |
Merge updates from master
Diffstat (limited to 'eclass/toolchain-funcs.eclass')
-rw-r--r-- | eclass/toolchain-funcs.eclass | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index a0c359a950b2..121db46e62b5 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -792,6 +792,73 @@ gcc-specs-stack-check() { } +# @FUNCTION: tc-enables-pie +# @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables +# @DESCRIPTION: +# Return truth if the current compiler generates position-independent code (PIC) +# which can be linked into executables. +tc-enables-pie() { + local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null + #if defined(__PIE__) + true + #endif + EOF + )" + [[ ${ret} == true ]] +} + +# @FUNCTION: tc-enables-ssp +# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least minimal level +# @DESCRIPTION: +# Return truth if the current compiler enables stack smashing protection (SSP) +# on level corresponding to any of the following options: +# -fstack-protector +# -fstack-protector-strong +# -fstack-protector-all +tc-enables-ssp() { + local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null + #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__) + true + #endif + EOF + )" + [[ ${ret} == true ]] +} + +# @FUNCTION: tc-enables-ssp-strong +# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least middle level +# @DESCRIPTION: +# Return truth if the current compiler enables stack smashing protection (SSP) +# on level corresponding to any of the following options: +# -fstack-protector-strong +# -fstack-protector-all +tc-enables-ssp-strong() { + local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null + #if defined(__SSP_STRONG__) || defined(__SSP_ALL__) + true + #endif + EOF + )" + [[ ${ret} == true ]] +} + +# @FUNCTION: tc-enables-ssp-all +# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on maximal level +# @DESCRIPTION: +# Return truth if the current compiler enables stack smashing protection (SSP) +# on level corresponding to any of the following options: +# -fstack-protector-all +tc-enables-ssp-all() { + local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null + #if defined(__SSP_ALL__) + true + #endif + EOF + )" + [[ ${ret} == true ]] +} + + # @FUNCTION: gen_usr_ldscript # @USAGE: [-a] <list of libs to create linker scripts for> # @DESCRIPTION: |