[PATCH] arm: Prevent GCC from using VFP registers in code used during dynamic linking

Aurelien Jarno aurelien@aurel32.net
Sun May 10 22:00:31 GMT 2026


Starting with GCC 15, VFP registers are used more aggressively on ARM,
including in ld.so code involved in runtime linking. For instance d7 is
used in _dl_lookup_symbol_, which clobbers the 8th floating point
argument of a function on its first call.
---
 sysdeps/arm/Makefile | 5 +++++
 1 file changed, 5 insertions(+)

This has been found by debugging the erfa testsuite failure on
debian/armhf:
https://buildd.debian.org/status/fetch.php?pkg=erfa&arch=armhf&ver=2.0.1-3&stamp=1778424772&raw=0

diff --git a/sysdeps/arm/Makefile b/sysdeps/arm/Makefile
index d08dade3c5..d66ea902cb 100644
--- a/sysdeps/arm/Makefile
+++ b/sysdeps/arm/Makefile
@@ -2,6 +2,11 @@ gnulib-arch = $(elf-objpfx)libgcc-stubs.a
 static-gnulib-arch = $(elf-objpfx)libgcc-stubs.a
 
 ifeq ($(subdir),elf)
+# Prevent GCC from using VFP register in code used during dynamic linking.
+CFLAGS-dl-lookup.os = -mgeneral-regs-only
+CFLAGS-dl-misc.os = -mgeneral-regs-only
+CFLAGS-dl-runtime.os = -mgeneral-regs-only
+
 sysdep-dl-routines += tlsdesc dl-tlsdesc
 sysdep_routines += aeabi_unwind_cpp_pr1 find_exidx
 sysdep-rtld-routines += aeabi_unwind_cpp_pr1
-- 
2.53.0



More information about the Libc-alpha mailing list