commit: 64e9b736c728fc62da48ea290441e0048f515dad
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 12 18:44:27 2017 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Dec 12 18:44:27 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=64e9b736
eclass: sync toolchain-funcs.eclass by hsk17, bug #639882
eclass/toolchain-funcs.eclass | 69 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 1 deletion(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index bf70ab979e..d9450c3584 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -602,7 +602,7 @@ tc-endian() {
case ${host} in
aarch64*be) echo big;;
aarch64) echo little;;
- alpha*) echo big;;
+ alpha*) echo little;;
arm*b*) echo big;;
arm*) echo little;;
cris*) echo little;;
@@ -822,6 +822,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 | grep '^true$'
+ #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 | grep '^true$'
+ #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 | grep '^true$'
+ #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 | grep '^true$'
+ #if defined(__SSP_ALL__)
+ true
+ #endif
+ EOF
+ )"
+ [[ ${ret} == true ]]
+}
+
+
# @FUNCTION: gen_usr_ldscript
# @USAGE: [-a] <list of libs to create linker scripts for>
# @DESCRIPTION: