From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7302 invoked by alias); 10 Aug 2017 21:32:47 -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 7218 invoked by uid 89); 10 Aug 2017 21:32:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Aug 2017 21:32:45 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12FBD72FDF; Thu, 10 Aug 2017 21:32:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 12FBD72FDF Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id D775517B52; Thu, 10 Aug 2017 21:32:41 +0000 (UTC) Subject: Re: [AArch64][6/6] Core file support for "pauth" feature To: Yao Qi References: <20170810212238.GE8039@1170ee0b50d5> Cc: Jiong Wang , GDB , Binutils From: Pedro Alves Message-ID: <26b4881d-bec9-e2a6-fe96-13f2a44f7b1f@redhat.com> Date: Thu, 10 Aug 2017 21:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20170810212238.GE8039@1170ee0b50d5> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-08/txt/msg00224.txt.bz2 On 08/10/2017 10:22 PM, Yao Qi wrote: > On 17-08-10 12:08:36, Pedro Alves wrote: >>> +#ifndef HWCAP_APIA >>> +/* AArch64 GNU/Linux HWCAP values. These should be synced with kernel >>> + definitions. */ >>> +#define HWCAP_APIA (1 << 16) >>> +#endif >> >> Re. the #ifndef, consider that tdep.h files are included in cross >> debugger builds. E.g., an x86-hosted gdb cross debugging aarch64. >> Some archs have "namespaced" names like the s390 mips, sparc, etc. >> (e.g., HWCAP_S390_VX) which avoids the case of the names being defined >> on host/target with a different meanings/values, but not all do. >> But even with such names, we always have to provide fallback definitions >> for cross debuggers. And with that all in mind, and since you're defining >> fallbacks anyway, how about unconditionally defining/using our >> own conflict-resistant versions, like AARCH64_HWCAP_APIA? >> > > I am inclined to use the same macro name as kernel uses. These macros are > only used in $arch-linux-{tdep,nat}.c, so it is clear that the macros > are about architecture $arch. I think there's a misunderstanding. It's not about clarity -- if HWCAP_APIA is defined on a !Aarch64 host as some value other than "(1 << 16)", then this: > +++ b/gdb/aarch64-linux-tdep.c > > - return tdesc_aarch64; > + return aarch64_hwcap & HWCAP_APIA ? tdesc_aarch64_pauth : tdesc_aarch64; > } will silently compile to use wrong value. Might never happen in practice, but why write a potential problem, _particularly since you already have to write the fallback macro anyway_? What's the advantage of not doing what I suggested? It'd be different if the macro was _only_ used in a -nat.c file, but then I'd object to defining it in the -tdep.h file. Thanks, Pedro Alves