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 A4C2C385085A for ; Thu, 20 Oct 2022 15:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4C2C385085A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=foss.arm.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=foss.arm.com 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 47E63D6E; Thu, 20 Oct 2022 08:15:45 -0700 (PDT) Received: from [10.57.35.253] (unknown [10.57.35.253]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 15AA43F67D; Thu, 20 Oct 2022 08:15:37 -0700 (PDT) Message-ID: Date: Thu, 20 Oct 2022 16:15:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 7/15] arm: Emit build attributes for PACBTI target feature Content-Language: en-GB To: Kyrylo Tkachov , 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=-3496.5 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 20/10/2022 15:47, Kyrylo Tkachov via Gcc-patches wrote: > Hi Andrea, > >> -----Original Message----- >> From: Gcc-patches > bounces+kyrylo.tkachov=arm.com@gcc.gnu.org> On Behalf Of Andrea >> Corallo via Gcc-patches >> Sent: Friday, August 12, 2022 4:31 PM >> To: Andrea Corallo via Gcc-patches >> Cc: Richard Earnshaw ; nd >> Subject: [PATCH 7/15] arm: Emit build attributes for PACBTI target feature >> >> This patch emits assembler directives for PACBTI build attributes as >> defined by the >> ABI. >> >> > aa/releases/download/2021Q1/addenda32.pdf> >> >> gcc/ChangeLog: >> >> * config/arm/arm.c (arm_file_start): Emit EABI attributes for >> Tag_PAC_extension, Tag_BTI_extension, TAG_BTI_use, >> TAG_PACRET_use. >> >> gcc/testsuite/ChangeLog: >> >> * gcc.target/arm/acle/pacbti-m-predef-1.c: New test. >> * gcc.target/arm/acle/pacbti-m-predef-3: Likewise. >> * gcc.target/arm/acle/pacbti-m-predef-6.c: Likewise. >> * gcc.target/arm/acle/pacbti-m-predef-7.c: Likewise. >> >> Co-Authored-By: Tejas Belagod > > diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc > index 0068817b0f2..ceec14f84b6 100644 > --- a/gcc/config/arm/arm.cc > +++ b/gcc/config/arm/arm.cc > @@ -28349,6 +28349,8 @@ static void > arm_file_start (void) > { > int val; > + bool pac = (aarch_ra_sign_scope != AARCH_FUNCTION_NONE); > + bool bti = (aarch_enable_bti == 1); > > arm_print_asm_arch_directives > (asm_out_file, TREE_TARGET_OPTION (target_option_default_node)); > @@ -28419,6 +28421,22 @@ arm_file_start (void) > arm_emit_eabi_attribute ("Tag_ABI_FP_16bit_format", 38, > (int) arm_fp16_format); > > + if (TARGET_HAVE_PACBTI) > + { > + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 2); > + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 2); > + } > + else if (pac || bti) > + { > + arm_emit_eabi_attribute ("Tag_PAC_extension", 50, 1); > + arm_emit_eabi_attribute ("Tag_BTI_extension", 52, 1); > + } > > This hunk will set both Tag_PAC_extension and Tag_BTI_extension if only one of pac or bti is on. Is that intended? > Would it makes sense to instead set the two Tag_*_extension tags individually as in the hunk below? That's because they are one feature in armv8-m and these tags describe the presence of the feature in the architecture. > + > + if (bti) > + arm_emit_eabi_attribute ("TAG_BTI_use", 74, 1); > + if (pac) > + arm_emit_eabi_attribute ("TAG_PACRET_use", 76, 1); > + But this describes /use/ by the code of each feature. R. > if (arm_lang_output_object_attributes_hook) > arm_lang_output_object_attributes_hook(); > } > > Thanks, > Kyrill >