From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 2ACFF3856DD9 for ; Fri, 1 Jul 2022 13:03:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2ACFF3856DD9 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB75D113E; Fri, 1 Jul 2022 06:03:03 -0700 (PDT) Received: from [10.2.78.56] (unknown [10.2.78.56]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0550B3F66F; Fri, 1 Jul 2022 06:03:02 -0700 (PDT) Message-ID: <37b6b3d9-bd69-e34a-e762-5312638338f9@foss.arm.com> Date: Fri, 1 Jul 2022 14:03:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 4/12] arm: Add testsuite library support for PACBTI target Content-Language: en-GB To: Andrea Corallo , Andrea Corallo via Gcc-patches Cc: Richard Earnshaw , nd References: From: Richard Earnshaw In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3490.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2022 13:03:14 -0000 On 28/04/2022 10:40, Andrea Corallo via Gcc-patches wrote: > Add targeting-checking entities for PACBTI in testsuite > framework. > > Pre-approved with the requested changes here > . > > gcc/testsuite/ChangeLog: > > * testsuite/lib/target-supports.exp: > (check_effective_target_arm_pacbti_hw): New. > * doc/sourcebuild.texi: Document arm_pacbti_hw. > > Co-Authored-By: Tejas Belagod > +proc check_effective_target_arm_pacbti_hw {} { + return [check_runtime arm_pacbti_hw_available { + __attribute__ ((naked)) int + main (void) + { + asm ("pac r12, lr, sp"); So the armv8-m Arm ARM says that this instruction is in the NOP space and that it is undefined if we aren't armv8-m.main or higher. + asm ("mov r0, #0"); + asm ("autg r12, lr, sp"); This isn't in the nop space, but the Arm ARM says it is unpredictable if the extension isn't present. Unfortunately, that means this isn't a particularly reliable way of detecting that the PACBTI feature is present. However, I can't think off hand of more reliable way of testing this since reading the feature register ID_ISAR5 is not possible when in unprivileged mode. So I think we'll have to live with this. + asm ("bx lr"); + } + } ""] OK. R.