commit:     ac450135f29ef850303589af998373d936955476
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 20 09:35:00 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Dec 20 09:52:55 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ac450135

sys-libs/glibc: enable IFUNC support only on whitelisted ARCHes, bug #641216

We explicitly disable IFUNC support on the following targets:
    alpha/hppa/ia64/mips/m68k/nios2/riscv/sh
to workaround weak IFUNC detection on binutils/glibc side.

Otherwise at least on ia64 glibc generates IFUNC entries against
compat librt.so.1 symbols (to redirect them back to libc.so.6)
but linker does not produce correct relocations. As a result all
IFUNC-backed functions don't work.

Reported-by: Émeric Maschino
Bug: https://sourceware.org/PR22634
Closes: https://bugs.gentoo.org/641216
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 eclass/toolchain-glibc.eclass       | 11 +++++++++++
 sys-libs/glibc/glibc-2.26-r3.ebuild | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/eclass/toolchain-glibc.eclass b/eclass/toolchain-glibc.eclass
index 6580be2fb1e..d9c692f2ad8 100644
--- a/eclass/toolchain-glibc.eclass
+++ b/eclass/toolchain-glibc.eclass
@@ -815,6 +815,17 @@ glibc_do_configure() {
                esac
        fi
 
+       # Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+       # is not robust enough to detect proper support:
+       #    https://bugs.gentoo.org/641216
+       #    https://sourceware.org/PR22634#c0
+       case $(tc-arch ${CTARGET}) in
+               # Keep whitelist of targets where autodetection mostly works.
+               amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+               # Blacklist everywhere else
+               *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+       esac
+
        if version_is_at_least 2.25 ; then
                myconf+=( --enable-stackguard-randomization )
        else

diff --git a/sys-libs/glibc/glibc-2.26-r3.ebuild 
b/sys-libs/glibc/glibc-2.26-r3.ebuild
index ceb5b684685..b936a612e1f 100644
--- a/sys-libs/glibc/glibc-2.26-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.26-r3.ebuild
@@ -342,6 +342,17 @@ glibc_do_configure() {
        esac
        myconf+=( --enable-stackguard-randomization )
 
+       # Keep a whitelist of targets supporing IFUNC. glibc's ./configure
+       # is not robust enough to detect proper support:
+       #    https://bugs.gentoo.org/641216
+       #    https://sourceware.org/PR22634#c0
+       case $(tc-arch ${CTARGET}) in
+               # Keep whitelist of targets where autodetection mostly works.
+               amd64|x86|sparc|ppc|ppc64|arm|arm64|s390) ;;
+               # Blacklist everywhere else
+               *) myconf+=( libc_cv_ld_gnu_indirect_function=no ) ;;
+       esac
+
        [[ $(tc-is-softfloat) == "yes" ]] && myconf+=( --without-fp )
 
        if [[ $1 == "nptl" ]] ; then

Reply via email to