commit:     525bc6c0fef5bc316812df10a93dceafdfe25e16
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 17 10:41:08 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Nov 17 10:42:00 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=525bc6c0

sys-libs/glibc: mangle bad -march= only for ABI=x86

Normally setup_target_flags() attempts to guard against
too conservative (or missing) -march= value by chacking
if sync primitives can be compiled. If it can't be compiled
glibc assumes -march= value to be too low.

Unfortunately, test always runs against 32-bit ABI without
checking if current ABI is actually 32-bit. This causes
the test mis-fire on USE=-multilib ARCH=amd64 systems.

Sweep workaround under ABI=x86 case.

Reported-by: Klaus Kusche
Closes: https://bugs.gentoo.org/700232
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r2.ebuild | 5 ++---
 sys-libs/glibc/glibc-9999.ebuild    | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.30-r2.ebuild 
b/sys-libs/glibc/glibc-2.30-r2.ebuild
index 910396913f2..21a2145abdd 100644
--- a/sys-libs/glibc/glibc-2.30-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r2.ebuild
@@ -256,9 +256,8 @@ setup_target_flags() {
                ;;
                amd64)
                        # -march needed for #185404 #199334
-                       # Note: This test only matters when the x86 ABI is 
enabled, so we could
-                       # optimize a bit and elide it.
                        # TODO: See cross-compile issues listed above for x86.
+                       [[ ${ABI} == x86 ]] &&
                        if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, 
void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n'; 
then
                                local t=${CTARGET_OPT:-${CTARGET}}
                                t=${t%%-*}
@@ -269,7 +268,7 @@ setup_target_flags() {
                                # ugly, ugly, ugly.  ugly.
                                CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags 
'-march=*'; echo "${CFLAGS}")
                                export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
-                               einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404"
+                               einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404 (ABI=${ABI})"
                        fi
                ;;
                mips)

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index f1b57d70806..4ddf0a27321 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -257,9 +257,8 @@ setup_target_flags() {
                ;;
                amd64)
                        # -march needed for #185404 #199334
-                       # Note: This test only matters when the x86 ABI is 
enabled, so we could
-                       # optimize a bit and elide it.
                        # TODO: See cross-compile issues listed above for x86.
+                       [[ ${ABI} == x86 ]] &&
                        if ! do_compile_test "${CFLAGS_x86}" 'void f(int i, 
void *p) {if (__sync_fetch_and_add(&i, 1)) f(i, p);}\nint main(){return 0;}\n'; 
then
                                local t=${CTARGET_OPT:-${CTARGET}}
                                t=${t%%-*}
@@ -270,7 +269,7 @@ setup_target_flags() {
                                # ugly, ugly, ugly.  ugly.
                                CFLAGS_x86=$(CFLAGS=${CFLAGS_x86} filter-flags 
'-march=*'; echo "${CFLAGS}")
                                export CFLAGS_x86="${CFLAGS_x86} -march=${t}"
-                               einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404"
+                               einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404 (ABI=${ABI})"
                        fi
                ;;
                mips)

Reply via email to