commit:     604495b43aa4a5b7aed2044b84ca0d88e600d1df
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 10 09:45:39 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 10:12:18 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=604495b4

glibc: disable stack protector on ARCH=ppc

Currently gcc on powerpc32 generates invalid code for
__builtin_return_address(0) calls. Normally programs
don't do that but malloc() hooks in glibc do:

Bug: https://gcc.gnu.org/PR81996
Bug: https://bugs.gentoo.org/629054
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/toolchain-glibc.eclass       | 14 +++++++++++++-
 sys-libs/glibc/glibc-2.26-r1.ebuild | 14 +++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
index 33f27ccf46e..98e394659cf 100644
--- a/eclass/toolchain-glibc.eclass
+++ b/eclass/toolchain-glibc.eclass
@@ -795,7 +795,19 @@ glibc_do_configure() {
        fi
 
        if version_is_at_least 2.25 ; then
-               myconf+=( --enable-stack-protector=all )
+               case ${CTARGET} in
+                       powerpc-*)
+                               # Currently gcc on powerpc32 generates invalid 
code for
+                               # __builtin_return_address(0) calls. Normally 
programs
+                               # don't do that but malloc hooks in glibc do:
+                               # https://gcc.gnu.org/PR81996
+                               # https://bugs.gentoo.org/629054
+                               myconf+=( --enable-stack-protector=no )
+                               ;;
+                       *)
+                               myconf+=( --enable-stack-protector=all )
+                               ;;
+               esac
        fi
 
        if version_is_at_least 2.25 ; then

diff --git a/sys-libs/glibc/glibc-2.26-r1.ebuild 
b/sys-libs/glibc/glibc-2.26-r1.ebuild
index fbe7444f948..b852aba96bc 100644
--- a/sys-libs/glibc/glibc-2.26-r1.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r1.ebuild
@@ -315,7 +315,19 @@ glibc_do_configure() {
        [[ -d ports ]] && addons+=",ports"
        popd > /dev/null
 
-       myconf+=( --enable-stack-protector=all )
+       case ${CTARGET} in
+               powerpc-*)
+                       # Currently gcc on powerpc32 generates invalid code for
+                       # __builtin_return_address(0) calls. Normally programs
+                       # don't do that but malloc hooks in glibc do:
+                       # https://gcc.gnu.org/PR81996
+                       # https://bugs.gentoo.org/629054
+                       myconf+=( --enable-stack-protector=no )
+                       ;;
+               *)
+                       myconf+=( --enable-stack-protector=all )
+                       ;;
+       esac
        myconf+=( --enable-stackguard-randomization )
 
        [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )

Reply via email to