From patchwork Thu Oct 19 17:17:38 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: 23697 Received: (qmail 42866 invoked by alias); 19 Oct 2017 17:17:50 -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 42854 invoked by uid 89); 19 Oct 2017 17:17:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=H*M:e049, H*M:3553 X-HELO: mail-qt0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7zXTaZwxllbg+2XppEPu0Q2k6RK+/F40NHqaMwIMr4g=; b=FeRYVKRQPytLDkWsmwcZONGObmZ9qS2HnOH6kO4Wonnm75aNTXtsjBSwQhfC5rJPb2 aKnYEQfYItKrmAyTfUhseFBqXE0OnllCLc+xZHzxZ89zru+YECqg99uH9nmoBcbOE1aX p+yKCsemUYc6HiAxt/Bn5zcsVbvHQLcsfPr+PkqPQ5i+lB6jbyiPxb7hF/xkvjKvGdlU yBVuwDoBgZClq+RI9Mx9jgZc33ETfryWsvUktmz9nBA9nkOeYDLnT3QEXJ6I6MIlW9tA FiflDioAiwzSL5ifTbpPrPEoDn0Os3s+T3U83zcya2omF3O8nSvlpC31TpsKgIGT506Q xYbQ== X-Gm-Message-State: AMCzsaWcu7KjvopjmmM+1C/IvkUYHQH2F1J9hiAv3TT/sNOyaESQbw5O 6IJd0gk1iQBgCLoVhAGRNOJFGrXGBvQ= X-Google-Smtp-Source: ABhQp+SQSDM/saPNUuWpacFJj+afljLmRSvotve+TMUvUgqPJru6+qqgu3we8etpiA4ZGJ0RcaFBdA== X-Received: by 10.200.41.90 with SMTP id z26mr2916149qtz.47.1508433463237; Thu, 19 Oct 2017 10:17:43 -0700 (PDT) Subject: Re: [PATCH 1/5] Avoid build multiarch if compiler warns about mismatched alias To: Joseph Myers Cc: libc-alpha@sourceware.org References: <1507842584-28674-1-git-send-email-adhemerval.zanella@linaro.org> <23df6e91-c3ed-f8fd-b94c-cf1b17978093@linaro.org> <8e50a466-cc0f-bcb2-9193-8b44d7fbf8b8@linaro.org> <8c40e9b9-56dc-1e88-9e76-2ffa29cffca3@linaro.org> From: Adhemerval Zanella Message-ID: Date: Thu, 19 Oct 2017 15:17:38 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: On 19/10/2017 14:49, Joseph Myers wrote: > On Thu, 19 Oct 2017, Adhemerval Zanella wrote: > >> For armv7-linux-gnueabihf with GCC8 without ifunc support on compiler: >> >> checking for assembler and linker STT_GNU_IFUNC support... yes >> checking for gcc attribute ifunc support... no >> checking if compiler warns about alias for function with incompatible types... yes >> configure: WARNING: gcc emits a warning for alias between functions of incompatible types. >> Multi-arch is disabled. > > Note that for this case, with explicit --enable-multi-arch, there should > be an error, much like that for missing assembler / linker support in that > case (while for the default case without the configure option, a warning > plus disabling multi-arch is appropriate). I don't think this patch > achieves that. > Right, current approach disable multiarch in this case. What about the below (using arm-linux-gnueabihf as target): * GCC6: checking for assembler and linker STT_GNU_IFUNC support... yes checking for gcc attribute ifunc support... no checking if compiler warns about alias for function with incompatible types... no checking sysdep dirs... sysdeps/unix/sysv/linux/arm sysdeps/arm/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/armv7/multiarch sysdeps/arm/armv7 sysdeps/arm/armv6t2 sysdeps/arm/armv6 sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic * GCC6 with --enable-multi-arch: checking for assembler and linker STT_GNU_IFUNC support... yes checking for gcc attribute ifunc support... no checking if compiler warns about alias for function with incompatible types... no configure: WARNING: --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 checking sysdep dirs... sysdeps/unix/sysv/linux/arm sysdeps/arm/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/armv7/multiarch sysdeps/arm/armv7 sysdeps/arm/armv6t2 sysdeps/arm/armv6 sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic * GCC8 without ifunc support and default config options: checking for assembler and linker STT_GNU_IFUNC support... yes checking for gcc attribute ifunc support... no checking if compiler warns about alias for function with incompatible types... yes configure: WARNING: gcc emits a warning for alias between functions of incompatible types configure: WARNING: Multi-arch is disabled. checking sysdep dirs... sysdeps/unix/sysv/linux/arm sysdeps/arm/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/armv7 sysdeps/arm/armv6t2 sysdeps/arm/armv6 sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic * GCC8 without ifunc support and with --enable-multi-arch: checking for assembler and linker STT_GNU_IFUNC support... yes checking for gcc attribute ifunc support... no checking if compiler warns about alias for function with incompatible types... yes configure: WARNING: gcc emits a warning for alias between functions of incompatible types configure: error: --enable-multi-arch support requires a gcc with gnu-indirect-function support * GC8 with ifunc support: checking for assembler and linker STT_GNU_IFUNC support... yes checking for gcc attribute ifunc support... yes checking if compiler warns about alias for function with incompatible types... yes checking sysdep dirs... sysdeps/unix/sysv/linux/arm sysdeps/arm/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/arm sysdeps/unix sysdeps/posix sysdeps/arm/armv7/multiarch sysdeps/arm/armv7 sysdeps/arm/armv6t2 sysdeps/arm/armv6 sysdeps/arm sysdeps/wordsize-32 sysdeps/ieee754/flt-32 sysdeps/ieee754/dbl-64 sysdeps/ieee754 sysdeps/generic I think it would be better to display the warning message on default configuration as well (I think that was my initial intention on changing the multi_arch default), but I think we can address it on a subsequent patch. diff --git a/configure.ac b/configure.ac index 195e81a..cde1585 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) @@ -641,10 +661,21 @@ if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then multi_arch=no fi fi -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. +if test x"$libc_cv_gcc_indirect_function" != xyes; then + # GCC 8+ emits and warning for alias with incompatible types and it might + # fail to 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; then + AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types]) + if test x"$multi_arch" = xyes; then + AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support]) + fi + AC_MSG_WARN([Multi-arch is disabled.]) + multi_arch=no + elif 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]) + fi fi multi_arch_d= if test x"$multi_arch" != xno; then