[PATCH 19/20] alpha: add multiarch infrastructure for IFUNC dispatch

Magnus Lindholm linmag7@gmail.com
Wed Aug 12 18:29:53 GMT 2026


On Wed, Aug 12, 2026 at 3:20 AM Matt Turner <mattst88@gmail.com> wrote:
>
> Add the framework for runtime CPU-based dispatch on alpha.
>
> init-arch.h wraps the implver and amask instructions, which resolvers use
> directly rather than going through AT_HWCAP: both are unprivileged, so a
> resolver can ask the processor what it is without help from the kernel.
> IS_EV6_OR_LATER tests implver for the 21264 family, IS_EV7_OR_LATER for the
> 21364, and HAS_CIX asks amask for the count extension the 21264A introduced.
>
> ifunc-impl-list.c enumerates the implementations for the string tests, which
> run each one in turn rather than only whichever the resolver picks.
>
> The dynamic linker cannot dispatch through an IFUNC before it has relocated
> itself, so dl-symbol-redir-ifunc.h names an implementation directly for the
> functions it needs while bootstrapping.  Only the static dynamic linker
> needs the redirection; the shared one has its own copies of these functions
> and the multiarch variants are not linked into it.
>
> configure inserts <machine>/multiarch immediately before <machine> for each
> term of the Implies chain, so a multiarch directory shadows only the assembly
> in its own directory.  sysdeps/alpha/multiarch therefore sits after
> sysdeps/alpha/alphaev6 and sysdeps/alpha/alphaev67 in sysnames, and an
> --host=alphaev6 or later build picks the CPU assembly over the dispatchers,
> leaving IFUNC dispatch inert on exactly the configurations that have the
> tuned implementations.  Give the two levels that carry assembly an
> Implies-only multiarch directory chaining down to sysdeps/alpha/multiarch,
> as powerpc does for its per-CPU directories, which places the dispatchers
> ahead of the assembly.  A --disable-multi-arch build is unaffected: no
> multiarch directory enters sysnames and the assembly is used directly.
> ---

Hi Matt,

It does not build on its own with multiarch enabled.
sysdeps/alpha/multiarch/Makefile at this commit has

    sysdep_routines += memset_ev5 memset_ev6 rawmemchr_ev5 ... strncat_ev67

and ifunc-impl-list.c references __memset_ev5, __strlen_ev67 and the rest, but
all 36 wrapper sources arrive in 20/20.  make stops at "No rule to make target
memset_ev5.o".  Either the Makefile and ifunc-impl-list.c move to 20/20, or the
wrappers move here.

Magnus


More information about the Libc-alpha mailing list