[PATCH 5/5] xen: arm64: remove -mgeneral-regs-only for vfp.c

Volodymyr Babchuk posted 5 patches 3 weeks, 6 days ago
[PATCH 5/5] xen: arm64: remove -mgeneral-regs-only for vfp.c
Posted by Volodymyr Babchuk 3 weeks, 6 days ago
vfp.c actually accesses VFP registers, so it can't be built with
-mgeneral-regs-only flag when using clang, as clang will complain
about this:

arch/arm/arm64/vfp.c:9:18: error: instruction requires: fp-armv8
    9 |     asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"
      |

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 xen/arch/arm/arm64/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile
index 6491c5350b..af949b8ee6 100644
--- a/xen/arch/arm/arm64/Makefile
+++ b/xen/arch/arm/arm64/Makefile
@@ -18,3 +18,5 @@ obj-$(CONFIG_ARM64_SVE) += sve.o sve-asm.o
 obj-y += traps.o
 obj-y += vfp.o
 obj-y += vsysreg.o
+
+$(obj)/vfp.o: CFLAGS_REMOVE += -mgeneral-regs-only
-- 
2.47.0
Re: [PATCH 5/5] xen: arm64: remove -mgeneral-regs-only for vfp.c
Posted by Jan Beulich 3 weeks, 6 days ago
On 29.11.2024 02:49, Volodymyr Babchuk wrote:
> vfp.c actually accesses VFP registers, so it can't be built with
> -mgeneral-regs-only flag when using clang, as clang will complain
> about this:
> 
> arch/arm/arm64/vfp.c:9:18: error: instruction requires: fp-armv8
>     9 |     asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"
>       |

Imo this needs addressing by inserting appropriate .arch_extension directives
in the asm(), to limit the scope of where VFP registers can be used to _just_
where we want them used.

> --- a/xen/arch/arm/arm64/Makefile
> +++ b/xen/arch/arm/arm64/Makefile
> @@ -18,3 +18,5 @@ obj-$(CONFIG_ARM64_SVE) += sve.o sve-asm.o
>  obj-y += traps.o
>  obj-y += vfp.o
>  obj-y += vsysreg.o
> +
> +$(obj)/vfp.o: CFLAGS_REMOVE += -mgeneral-regs-only

This, after all, allows the compiler to also use them behind our backs.

Jan