From patchwork Mon Aug 8 14:38:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 14420 Received: (qmail 63155 invoked by alias); 8 Aug 2016 14:40:06 -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 62887 invoked by uid 89); 8 Aug 2016 14:40:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=fragment, H*Ad:D*linux-m68k.org X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: stli@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org From: Stefan Liebler To: libc-alpha@sourceware.org Cc: stli@linux.vnet.ibm.com, fweimer@redhat.com, murphyp@linux.vnet.ibm.com, schwab@linux-m68k.org, joseph_myers@mentor.com Subject: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc. Date: Mon, 8 Aug 2016 16:38:57 +0200 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16080814-0008-0000-0000-000002AE4F4C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16080814-0009-0000-0000-00001960E3B2 Message-Id: <1470667145-18563-1-git-send-email-stli@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-08_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608080161 This patch adds a configure check to test if gcc supports attribute ifunc. The support can either be enabled in /gcc/config.gcc for one architecture in general by setting default_gnu_indirect_function variable to yes or by configuring gcc with --enable-gnu-indirect-function. The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead of inline assembly to generate the IFUNC symbols due to false debuginfo. If gcc does not support attribute ifunc and glibc is configured with --enable-multi-arch then configure will abort with an error message. If --enable-multi-arch is not given then configure will silently disable multi-arch support. ChangeLog: * configure.ac: Add check if gcc supports attribute ifunc feature. * configure: Regenerated. --- configure | 38 +++++++++++++++++++++++++++++++++++--- configure.ac | 32 +++++++++++++++++++++++++++++--- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 17625e1..aedada3 100755 --- a/configure +++ b/configure @@ -3914,9 +3914,40 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_gnu_indirect_function" >&5 $as_echo "$libc_cv_ld_gnu_indirect_function" >&6; } -if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then +# Check if gcc supports attribute ifunc as it is used in libc_ifunc macro. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc attribute ifunc support" >&5 +$as_echo_n "checking for gcc attribute ifunc support... " >&6; } +if ${libc_cv_gcc_indirect_function+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 \ + 2>&5 ; then + if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&5; then + libc_cv_gcc_indirect_function=yes + fi +fi +rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_indirect_function" >&5 +$as_echo "$libc_cv_gcc_indirect_function" >&6; } + +if test x"$libc_cv_ld_gnu_indirect_function" != xyes \ + || test x"$libc_cv_gcc_indirect_function" != xyes; then if test x"$multi_arch" = xyes; then - as_fn_error $? "--enable-multi-arch support requires assembler and linker support" "$LINENO" 5 + as_fn_error $? "--enable-multi-arch support require gcc, assembler and linker indirect-function support" "$LINENO" 5 else multi_arch=no fi @@ -6499,7 +6530,8 @@ fi # A sysdeps configure fragment can reset this if IFUNC is not actually # usable even though the assembler knows how to generate the symbol type. -if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then +if test x"$libc_cv_ld_gnu_indirect_function" = xyes \ + && test x"$libc_cv_gcc_indirect_function" = xyes; then $as_echo "#define HAVE_IFUNC 1" >>confdefs.h fi diff --git a/configure.ac b/configure.ac index 33bcd62..0961151 100644 --- a/configure.ac +++ b/configure.ac @@ -634,9 +634,34 @@ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ fi rm -f conftest*]) -if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then +# Check if gcc supports attribute ifunc as it is used in libc_ifunc macro. +AC_CACHE_CHECK([for gcc attribute ifunc support], + libc_cv_gcc_indirect_function, [dnl +cat > conftest.c <&AS_MESSAGE_LOG_FD \ + 2>&AS_MESSAGE_LOG_FD ; then + if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then + libc_cv_gcc_indirect_function=yes + fi +fi +rm -f conftest*]) + +if test x"$libc_cv_ld_gnu_indirect_function" != xyes \ + || test x"$libc_cv_gcc_indirect_function" != xyes; then if test x"$multi_arch" = xyes; then - AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support]) + AC_MSG_ERROR([--enable-multi-arch support require gcc, assembler and linker indirect-function support]) else multi_arch=no fi @@ -1766,7 +1791,8 @@ AC_SUBST(libc_cv_gcc_unwind_find_fde) # A sysdeps configure fragment can reset this if IFUNC is not actually # usable even though the assembler knows how to generate the symbol type. -if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then +if test x"$libc_cv_ld_gnu_indirect_function" = xyes \ + && test x"$libc_cv_gcc_indirect_function" = xyes; then AC_DEFINE(HAVE_IFUNC) fi