From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1035) id 752143858C52; Fri, 3 Feb 2023 13:07:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 752143858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675429656; bh=0rt+KlwCynpw4M3pVv+rIlDErJzFasfsA+AD3NB431Y=; h=From:To:Subject:Date:From; b=fN39jbq5ghOZXhK6cHF8gcu1XhdlvSahPaoAd5s7lxPPzCnSeurbT7XvQyDoVzXxX MsoCAtE1F4jDDAkgeQKLtXKlJU3qepEshnKI1s5CshDsAZfgN/Dm+tO3GYnVeirYV5 wXQj7xuQ9JRDDjUDi7jq+Oug2SVW8Mh6l7f8lTv0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Richard Earnshaw To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] libc: arm: Implement setjmp GCC backwards compatibility. X-Act-Checkin: newlib-cygwin X-Git-Author: Victor L. Do Nascimento X-Git-Refname: refs/heads/master X-Git-Oldrev: 89f930a9649ed9e419c7d8b2372c684313069a5b X-Git-Newrev: c6e601de84ea9f2be2b026c609cc3c1fe82a3103 Message-Id: <20230203130736.752143858C52@sourceware.org> Date: Fri, 3 Feb 2023 13:07:36 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Dc6e601de84e= a9f2be2b026c609cc3c1fe82a3103 commit c6e601de84ea9f2be2b026c609cc3c1fe82a3103 Author: Victor L. Do Nascimento Date: Fri Feb 3 11:15:26 2023 +0000 libc: arm: Implement setjmp GCC backwards compatibility. =20 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. =20 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. =20 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. Diff: --- 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/set= jmp.S index c615f2428..5e5952296 100644 --- a/newlib/libc/machine/arm/setjmp.S +++ b/newlib/libc/machine/arm/setjmp.S @@ -64,6 +64,28 @@ =20 .syntax unified =20 +/* 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 =3D=3D 1 && !__ARM_ARCH_ISA_ARM /* ARMv6-M-like has to be implemented in Thumb mode. */