On Fri, Feb 06, 2026 at 07:55:03PM +0000, Wilco Dijkstra wrote: > Hi Alice, > > > AAPCS64* specifies several runtime support routines that must be > > supported by any platform that supports SME.� Add __arm_get_current_vg > > to libgcc to help meet this requirement.� This will be used to enable > > support for SME without (non-streaming) SVE. > > This looks OK, but a few comments below: > > +#include "aarch64-asm.h" > + > +/* Disable ZA.� Call ABI: > +�� - Private ZA, streaming-compatible. > +�� - x1-x15, x19-x29, sp and fp regs are call preserved. > > x18 should be call-preserved too (we have no reason not to).
This specification comes directly from the (Beta) ABI spec: https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#815__arm_get_current_vg > > +�� - Takes no argument. > +�� - Returns the value of the current VG in x0 if this value exists, and > +���� returns zero otherwise.� */ > + > +HIDDEN (__aarch64_cpu_features) > + > +variant_pcs (__arm_get_current_vg) > > I guess this ends up in the dynamic libgcc? So this will go via the PLT... > This is not a good design for many reasons. No need to fix this right now, > but in the future we should either inline or statically link these small > helper > functions. Both here and in patch 2/2 I've followed the approach already in use for __arm_sme_state, so your comments may be equally applicable there. When Szabolcs added __arm_sme_state, he wrote (in the commit message) that: The routines are in shared libgcc and static libgcc eh, even though they are not related to exception handling. This is to avoid linking a copy of the routines into dynamic linked binaries, because TPIDR2_EL0 block can be extended in the future which is better to handle in a single place per process. > > This is OK with a comment here that variant_pcs ensures the PLT gets > resolved at load-time so that the vector registers are corrupted... If you think this comment would be helpful, perhaps it would be worth adding it to the all of the affected files (as a separate patch, of course)? Thanks, Alice > > Cheers, > Wilco
