commit:     5f2d4eb56a6eba177bdf7134fe8e5f749ea67b90
Author:     Luke Dashjr <luke-jr+git <AT> utopios <DOT> org>
AuthorDate: Tue Aug  8 16:33:09 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Aug 10 21:55:43 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5f2d4eb5

toolchain.eclass: fix tc-enables-* with -ggdb3

-ggdb3 builds debug information for macros into binaries. For this reason,
the C preprocessor includes all #defines as-is in the output. The check
in tc-enables-* expects only a fixed output of "true", which fails in this
scenario.

To fix this, `grep` is used to look specifically for "true" in the output
from the preprocessor.

Closes: https://github.com/gentoo/gentoo/pull/5359
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
Signed-off-by: Matthias Maier <tamiko <AT> gentoo.org>

 eclass/toolchain-funcs.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 777fce905f3..aeb6f7c7029 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -798,7 +798,7 @@ gcc-specs-stack-check() {
 # 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
+       local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> 
/dev/null | grep '^true$'
                #if defined(__PIE__)
                true
                #endif
@@ -816,7 +816,7 @@ tc-enables-pie() {
 #  -fstack-protector-strong
 #  -fstack-protector-all
 tc-enables-ssp() {
-       local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> 
/dev/null
+       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
@@ -833,7 +833,7 @@ tc-enables-ssp() {
 #  -fstack-protector-strong
 #  -fstack-protector-all
 tc-enables-ssp-strong() {
-       local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> 
/dev/null
+       local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> 
/dev/null | grep '^true$'
                #if defined(__SSP_STRONG__) || defined(__SSP_ALL__)
                true
                #endif
@@ -849,7 +849,7 @@ tc-enables-ssp-strong() {
 # 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
+       local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> 
/dev/null | grep '^true$'
                #if defined(__SSP_ALL__)
                true
                #endif

Reply via email to