From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12000 invoked by alias); 1 Sep 2016 09:19:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 11989 invoked by uid 89); 1 Sep 2016 09:19:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Sep 2016 09:19:28 +0000 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u819DRr3031209 for ; Thu, 1 Sep 2016 05:19:26 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2569u0wrf8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 01 Sep 2016 05:19:26 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Sep 2016 10:19:24 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Sep 2016 10:19:22 +0100 X-IBM-Helo: d06dlp02.portsmouth.uk.ibm.com X-IBM-MailFrom: arnez@linux.vnet.ibm.com X-IBM-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 636DC219005F for ; Thu, 1 Sep 2016 10:18:44 +0100 (BST) Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u819JLjq29360188 for ; Thu, 1 Sep 2016 09:19:21 GMT Received: from d06av11.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u819JKuR004814 for ; Thu, 1 Sep 2016 03:19:21 -0600 Received: from oc1027705133.ibm.com (dyn-9-152-212-133.boeblingen.de.ibm.com [9.152.212.133]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u819JKBf004801 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 1 Sep 2016 03:19:20 -0600 From: Andreas Arnez To: Andrew Pinski Cc: "gdb-patches\@sourceware.org" , Ulrich Weigand , Stefan Liebler Subject: Re: [PATCH] Pass HWCAP to ifunc resolver References: Date: Thu, 01 Sep 2016 09:19:00 -0000 In-Reply-To: (Andrew Pinski's message of "Wed, 31 Aug 2016 22:03:06 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090109-0028-0000-0000-0000020B3174 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090109-0029-0000-0000-00002022DDE2 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-01_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1609010103 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00009.txt.bz2 On Thu, Sep 01 2016, Andrew Pinski wrote: > On Wed, Aug 31, 2016 at 4:49 AM, Andreas Arnez wrote: >> On various GNU Elf architectures, including AArch64, ARM, s390/s390x, >> ppc32/64, and sparc32/64, the dynamic loader passes HWCAP as a parameter >> to each ifunc resolver. Currently there is an open glibc Bugzilla that >> requests this to be generalized to all architectures: >> >> https://sourceware.org/bugzilla/show_bug.cgi?id=19766 >> >> And various ifunc resolvers already rely on receiving HWCAP. Currently >> GDB always calls an ifunc resolver without any arguments; thus the >> resolver may receive garbage, and based on that, the resolver may decide >> to return a function that is not suited for the given platform. >> >> This patch always passes HWCAP to ifunc resolvers, even on systems where >> the dynamic loader currently behaves otherwise. The rationale is >> that (1) the dynamic loader may get adjusted on those systems as well in >> the future; (2) passing an unused argument should not cause a problem >> with existing resolvers; and (3) the logic is much simpler without such >> a distinction. > > Doesn't some targets pass HWCAP2 too? If I understand the glibc code correctly, no. The loader maintains the variables dl_hwcap and dl_hwcap2 and fills them from AT_HWCAP and AT_HWCAP2, respectively, but the ifunc resolvers only receive dl_hwcap: ./sysdeps/aarch64/dl-irel.h:33: return ((ElfW(Addr) (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/arm/dl-irel.h:33: return ((Elf32_Addr (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/generic/dl-irel.h:26: return ((DL_FIXUP_VALUE_TYPE (*) (void)) (addr)) (); ./sysdeps/hppa/dl-irel.h:36: return ((struct fdesc) {0, 0}); ./sysdeps/i386/dl-irel.h:32: return ((Elf32_Addr (*) (void)) (addr)) (); ./sysdeps/powerpc/powerpc32/dl-irel.h:33: return ((Elf32_Addr (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/powerpc/powerpc64/dl-irel.h:34: return ((Elf64_Addr (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/s390/dl-irel.h:33: return ((ElfW(Addr) (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/sparc/sparc32/dl-irel.h:34: return ((Elf32_Addr (*) (int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/sparc/sparc64/dl-irel.h:34: return ((Elf64_Addr (*) (int)) (addr)) (GLRO(dl_hwcap)); ./sysdeps/x86_64/dl-irel.h:32: return ((ElfW(Addr) (*) (void)) (addr)) (); -- Andreas