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 81BEC3858C52 for ; Fri, 3 Feb 2023 13:07:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81BEC3858C52 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 7DB88C14; Fri, 3 Feb 2023 05:08:35 -0800 (PST) Received: from [10.2.78.76] (unknown [10.2.78.76]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B3C673F71E; Fri, 3 Feb 2023 05:07:52 -0800 (PST) Message-ID: <1f8740a9-0014-c473-e3e4-6af842cb18e8@foss.arm.com> Date: Fri, 3 Feb 2023 13:07:51 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v2] libc: arm: Implement setjmp GCC backwards compatibility. Content-Language: en-GB To: "Victor L. Do Nascimento" , newlib@sourceware.org Cc: richard.earnshaw@arm.com 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=-3495.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,NICE_REPLY_A,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 03/02/2023 11:15, Victor L. Do Nascimento wrote: > When compiling Newlib for arm targets with GCC 12.1 onward, the > passing of architecture extension information to the assembler is > automatic, making the use of .fpu and .arch_extension directives > in assembly files redundant. > > With older versions of GCC, however, these directives must be > hard-coded into the `arm/setjmp.S' file to allow the assembly of > instructions concerning the storage and subsequent reloading of the > floating point registers to/from the jump buffer, respectively. > > This patch conditionally adds the `.fpu vfpxd' and `.arch_extension > mve' directives based on compile-time preprocessor macros concerning > GCC version and target architectural features, such that both the > assembly and linking of setjmp.S succeeds for older versions of > Newlib. > --- > newlib/libc/machine/arm/setjmp.S | 22 ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) > > diff --git a/newlib/libc/machine/arm/setjmp.S b/newlib/libc/machine/arm/setjmp.S > index c615f2428..5401534cd 100644 > --- a/newlib/libc/machine/arm/setjmp.S > +++ b/newlib/libc/machine/arm/setjmp.S > @@ -64,6 +64,28 @@ > > .syntax unified > > +/* GCC 12.1 and later will tell the assembler exactly which floating > + point (or MVE) unit is required and we don't want to override > + that. Conversely, older versions of the compiler don't pass this > + information so we need to enable the VFP version that is most > + appropriate. The choice here should support all suitable VFP > + versions that the older toolchains can handle. */ > +#if __GNUC__ && __GNUC__ < 12 > +/* Ensure that FPU instructions are correctly compiled and, likewise, > + the appropriate build attributes are added to the resulting object > + file. Check whether the MVE extension is present and whether > + we have support for hardware floating point-operations. VFPxd > + covers all the cases we need in this file for hardware > + floating-point and should be compatible with all required FPUs > + that we need to support. */ > +# if __ARM_FP > + .fpu vfpxd > +# endif > +# if __ARM_FEATURE_MVE > + .arch_extension mve > +# endif > +#endif > + > #if __ARM_ARCH_ISA_THUMB == 1 && !__ARM_ARCH_ISA_ARM > /* ARMv6-M-like has to be implemented in Thumb mode. */ > Thanks, pushed.