sys-libs/glibc: mangle bad -march= only for ABI=x86
authorSergei Trofimovich <slyfox@gentoo.org>
Sun, 17 Nov 2019 10:41:08 +0000 (10:41 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Sun, 17 Nov 2019 10:42:00 +0000 (10:42 +0000)
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@gentoo.org>
sys-libs/glibc/glibc-2.30-r2.ebuild
sys-libs/glibc/glibc-9999.ebuild

index 910396913f25fd21619775d2e4e2fd51cc0fa8f3..21a2145abdd57c481086e410775cb9fdd587c584 100644 (file)
@@ -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)
index f1b57d70806c7de6dfc6d69492f059c81af1e8cb..4ddf0a2732197fa2db2a41c6f80a085279a281d9 100644 (file)
@@ -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)