commit:     3ff56613857700dd0dfe2937539ae13fc3212eb4
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 26 07:54:33 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Tue Jun 26 09:48:14 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ff56613

sys-libs/glibc: pass user's CFLAGS over CC/XX, not CPPFLAGS

Breakage example (before this change):
    # CFLAGS="-O2 -march=core2 -mno-sse4.2" emerge -v1 =glibc-2.27-r4

Here user's CFLAGS were able to override (this bug) glibc's
CFLAGS additions like:
    sysdeps/i386/i686/multiarch/Makefile:CFLAGS-strspn-c.c += -msse4

'strspn' was built as 'gcc -msse4 -mno-sse4.2' and failed:
    smmintrin.h:631:1: error: inlining failed in call to always_inline
        ‘_mm_cmpistri’: target specific option mismatch

This happens because we passed user's CFLAGS via CPPFLAGS:
   Makerules:COMPILE.c = $(CC) -c $(CFLAGS) $(CPPFLAGS)

To avoid this kind of overrides this change injects user's CFLAGS
into CC/CXX. Above example will use 'gcc -mno-sse4.2 -msse4' order.

Reported-by: Philipp Psurek
Bug: https://bugs.gentoo.org/657760
Closes: https://bugs.gentoo.org/659030
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 .../{glibc-9999.ebuild => glibc-2.27-r5.ebuild}    | 26 ++++++++++------------
 sys-libs/glibc/glibc-9999.ebuild                   | 16 ++++++-------
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/sys-libs/glibc/glibc-9999.ebuild 
b/sys-libs/glibc/glibc-2.27-r5.ebuild
similarity index 98%
copy from sys-libs/glibc/glibc-9999.ebuild
copy to sys-libs/glibc/glibc-2.27-r5.ebuild
index 11e503dd7aa..0e9283a66ca 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-2.27-r5.ebuild
@@ -18,8 +18,7 @@ if [[ ${PV} == 9999* ]]; then
        EGIT_REPO_URI="https://sourceware.org/git/glibc.git";
        inherit git-r3
 else
-       # KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc 
~ppc64 ~s390 ~sh ~sparc ~x86"
-       KEYWORDS=""
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 
~s390 ~sh ~sparc ~x86"
        SRC_URI="mirror://gnu/glibc/${P}.tar.xz"
 fi
 
@@ -28,12 +27,12 @@ RELEASE_VER=${PV}
 GCC_BOOTSTRAP_VER=20180511
 
 # Gentoo patchset
-PATCH_VER=6
+PATCH_VER=2
 
 SRC_URI+=" 
https://dev.gentoo.org/~dilfridge/distfiles/${P}-patches-${PATCH_VER}.tar.bz2";
 SRC_URI+=" multilib? ( 
https://dev.gentoo.org/~dilfridge/distfiles/gcc-multilib-bootstrap-${GCC_BOOTSTRAP_VER}.tar.xz
 )"
 
-IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd 
profile selinux suid systemtap test vanilla"
+IUSE="audit caps compile-locales doc gd hardened headers-only multilib nscd 
profile selinux suid systemtap vanilla"
 
 # Minimum kernel version that glibc requires
 MIN_KERN_VER="3.2.0"
@@ -78,10 +77,8 @@ DEPEND="${COMMON_DEPEND}
        !<sys-apps/portage-2.1.2
        !<sys-devel/bison-2.7
        doc? ( sys-apps/texinfo )
-       test? ( >=net-dns/libidn2-2.0.5 )
 "
 RDEPEND="${COMMON_DEPEND}
-       >=net-dns/libidn2-2.0.5
        sys-apps/gentoo-functions
        !sys-kernel/ps3-sources
        !sys-libs/nss-db
@@ -793,20 +790,21 @@ glibc_do_configure() {
                einfo " $(printf '%15s' ${v}:)   ${!v}"
        done
 
+       # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
+       # To build .S (assembly) files with the same ABI-specific flags
+       # upstream currently recommends adding CFLAGS to CC/CXX:
+       #    https://sourceware.org/PR23273
+       # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific 
CFLAGS
+       # and breaks multiarch support. See 659030#c3 for an example.
+
        # The glibc configure script doesn't properly use LDFLAGS all the time.
-       export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}"
+       export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
        einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 
        # Some of the tests are written in C++, so we need to force our multlib 
abis in, bug 623548
-       export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)"
+       export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
        einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
 
-       # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
-       # To build .S (assembly) files with the same ABI-specific flags
-       # upstream currently recommends adding CFLAGS to CPPFLAGS: 
https://sourceware.org/PR23273
-       export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
-       einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
-
        echo
 
        local myconf=()

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 11e503dd7aa..9417381e164 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -793,20 +793,20 @@ glibc_do_configure() {
                einfo " $(printf '%15s' ${v}:)   ${!v}"
        done
 
+       # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
+       # To build .S (assembly) files with the same ABI-specific flags
+       # upstream currently recommends adding CFLAGS to CC/CXX:
+       #    https://sourceware.org/PR23273
+       # Note: Passing CFLAGS via CPPFLAGS overrides glibc's arch-specific 
CFLAGS
+       # and breaks multiarch support. See 659030#c3 for an example.
        # The glibc configure script doesn't properly use LDFLAGS all the time.
-       export CC="$(tc-getCC ${CTARGET}) ${LDFLAGS}"
+       export CC="$(tc-getCC ${CTARGET}) ${CFLAGS} ${LDFLAGS}"
        einfo " $(printf '%15s' 'Manual CC:')   ${CC}"
 
        # Some of the tests are written in C++, so we need to force our multlib 
abis in, bug 623548
-       export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS)"
+       export CXX="$(tc-getCXX ${CTARGET}) $(get_abi_CFLAGS) ${CFLAGS}"
        einfo " $(printf '%15s' 'Manual CXX:')   ${CXX}"
 
-       # CFLAGS can contain ABI-specific flags like -mfpu=neon, see bug #657760
-       # To build .S (assembly) files with the same ABI-specific flags
-       # upstream currently recommends adding CFLAGS to CPPFLAGS: 
https://sourceware.org/PR23273
-       export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
-       einfo " $(printf '%15s' 'Manual CPPFLAGS:')   ${CPPFLAGS}"
-
        echo
 
        local myconf=()

Reply via email to