From patchwork Thu Oct 12 21:09:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 23514 Received: (qmail 102578 invoked by alias); 12 Oct 2017 21:10:03 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 101943 invoked by uid 89); 12 Oct 2017 21:10:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:3838, 6346 X-HELO: mail-qk0-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=othSC5QcrvKtS2BX1hBUJaqN5Bc0g4zVbgg9KfxTK8A=; b=q50N0JzBlyUceE6H5NDt0bkbLEbp2PYFPQ6nYvyn+Ue3NOvAbIpsKx55MgEUXe2DC4 oKpEsF9BWo8b5XOBECJnFTGbjDzKgBgYKDOkaRgQ/hgyUzp7VpGqXViBCPrlicJpW0PQ Xbv3nq9vThOqW1TsJ/HP1DIW9RFJoWh+rEziPi3p8+zPGaC8DcN3V1vxXzh+/AEVsszT ePvnTFlUb3QFPOAalUSeEkxKiYGlQijK+qkvtcMFN/BEpFdg54GCZbKX8X63Kw3AIHSZ lrtB5evv+wws1brnzih5ylGJn8uhjrR9JTxqhosVCT0MMMmm92tpKaOXPCxmlWYOq0ab jfSw== X-Gm-Message-State: AMCzsaUzO4pig2TJJyKOM3meBUQUXYlVoDNPgM7LH/P4QofCxs/5K8Oc k5sag2ova+GI9m1drXowhcx/CFS+C3k= X-Google-Smtp-Source: AOwi7QCQdkgbpv7gSJArpoljF8RnmKj6UBNBeZLTNwd/DhkBuE+eSeCK+f2acJFCf5tQ5nxP7mC40A== X-Received: by 10.55.98.205 with SMTP id w196mr2529951qkb.322.1507842594437; Thu, 12 Oct 2017 14:09:54 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/5] Avoid build multiarch if compiler warns about mismatched alias Date: Thu, 12 Oct 2017 18:09:40 -0300 Message-Id: <1507842584-28674-1-git-send-email-adhemerval.zanella@linaro.org> GCC 8 emits a warning for alias for functions with incompatible types and it is used extensivelly for ifunc resolvers implementations in C (for instance on weak_alias with the internal symbol name to the external one or with the libc_hidden_def to set ifunc for internal usage). This breaks the build when the ifunc resolver is not defined using gcc attribute extensions (HAVE_GCC_IFUNC being 0). Although for all currently architectures that have multiarch support this compiler options is enabled for default, there is still the option where the user might try build glibc with a compiler without support for such extension. In this case this patch just disable the multiarch folder in sysdeps selections. GCC 7 and before still builds IFUNCs regardless of compiler support (although for the lack of attribute support debug information would be optimal). The patch also fixes the default value of the multiarch support in configure.ac (the correct value which is tested later in the script assumes 'yes' instead of 'default'). Checked with a build on multiarch support architectures (aarch64,a arm, sparc, s390, powerpc, x86_64, i386) with multiarch enable and disable and with GCC 7 and GCC 8. * configure.ac (multi_arch): Use 'yes' as default value. (libc_cv_gcc_incompatbile_alias): New define: indicates whether compiler emits an warning for alias for functions with incompatible types. --- ChangeLog | 7 +++++++ configure | 39 ++++++++++++++++++++++++++++++++++++++- configure.ac | 31 ++++++++++++++++++++++++++++++- 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 195e81a..647aaa6 100644 --- a/configure.ac +++ b/configure.ac @@ -304,7 +304,7 @@ AC_ARG_ENABLE([multi-arch], AC_HELP_STRING([--enable-multi-arch], [enable single DSO with optimizations for multiple architectures]), [multi_arch=$enableval], - [multi_arch=default]) + [multi_arch=yes]) AC_ARG_ENABLE([experimental-malloc], AC_HELP_STRING([--disable-experimental-malloc], @@ -634,6 +634,26 @@ if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \ fi rm -f conftest*]) +# Check if gcc warns about alias for function with incompatible types. +AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types], + libc_cv_gcc_incompatible_alias, [dnl +cat > conftest.c <&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then + libc_cv_gcc_incompatible_alias=no +fi +rm -f conftest*]) + if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then if test x"$multi_arch" = xyes; then AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support]) @@ -645,6 +665,15 @@ if test x"$libc_cv_gcc_indirect_function" != xyes && test x"$multi_arch" = xyes; then AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support. Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function]) + # GCC 8+ emits and warning for alias with incompatible types and thus fail + # to build ifunc resolvers aliases to either weak or internal symbols. + # Disables multiarch build in this case. + if test x"$libc_cv_gcc_incompatible_alias" == xyes && + test x"$enable_werror" == xyes; then + AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types +and -Werror is enabled. Multi-arch is disabled. ]) + multi_arch=no + fi fi multi_arch_d= if test x"$multi_arch" != xno; then