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

Aurelien Jarno aurelien@aurel32.net
Mon May 11 21:50:14 GMT 2026


On 2026-05-11 15:26, Adhemerval Zanella Netto wrote:
> 
> 
> On 11/05/26 13:51, Aurelien Jarno wrote:
> > On 2026-05-11 10:54, Adhemerval Zanella Netto wrote:
> >>
> >>
> >> On 10/05/26 19:00, Aurelien Jarno wrote:
> >>> 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.
> >>
> >> We added the --with-rtld-early-cflags configure option for avoid such issue,
> >> couldn't this be used instead of specific flags to specific objects?
> > 
> > This is a configure option, so do you mean changing the default value 
> > for arm?
> 
> I think it should a decision on which ISA do you want to deploy glibc. 
> If you targetting armv7a system, runtime should be free to use any register
> on dynamic loader.

Yes, I am targetting a armv7a system, this is where the bug exists. I 
have opened bug libc/34144 with a small reproducer.

> > Anyway is doesn't work as it misses dl-lookup.os and dl-runtime.os, but 
> > works for dl-misc.os.
> > 
> 
> I think it would be better to add $(rtld-early-cflags) for such objects
> as well.
> 
> What I want to avoid is having multiple configurations on how to build
> startup code. We already have the stack-protector, stack usage, ifunc
> redirections to be aware.

Ok, I confirm that this way works. Now I just need a way to 
automatically add -mgeneral-regs-only to rtld-early-cflags on armv7 
systems using the hard float ABI. It looks like other architectures are 
not using this mechanism to achieve that.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net


More information about the Libc-alpha mailing list