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: 656771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3s7KpF3q0pz9sf9 for ; Tue, 9 Aug 2016 00:40:37 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=dKStBTDA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=KIHPe3gPc2lP5StpbQpjl0IsCE9SkA4cEMRJw/9BmDqtrfeRuk1Fq F6Mjr7TPxT2l8Ngq2qenaWEW1u0MYlKgVMuhxfplQGjaRU0B7Ph0YeI9t9bz4Puh qYOglf8sZnuuyPDa6DdKE4bxiM49n9BuQZPLA1k8/O8U7qj0GwJaHs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=tTerY5JDWKkHx4ootRdHoNhNMwM=; b=dKStBTDAv5EM4DzgxYECQZeWXt0A Ygj4rqBIaJ4xS9+t+H2QFqgUjOra7Fug/qw3buU67kymuEdosRjSrbUMaxumvOMf 3ZnWQDS4pOZ1ZtSOasjCztXwP/4Y3ZlNXlOndYyI55yJPkKeVGv6HmTwU8xSn421 K8yPtELT4lIRUYc= 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