[PATCH v4 2/3] aarch64: avoid populating __ifunc_arg_t struct multiple times
Yury Khrustalev
yury.khrustalev@arm.com
Fri Apr 25 11:35:21 GMT 2025
Set fields of the __ifunc_arg_t struct in elf_ifunc_invoke()
only once to avoid repeating this for each ifunc resolver.
---
sysdeps/aarch64/dl-irel.h | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/sysdeps/aarch64/dl-irel.h b/sysdeps/aarch64/dl-irel.h
index 9abf7a60a1..0f1ad5f2d6 100644
--- a/sysdeps/aarch64/dl-irel.h
+++ b/sysdeps/aarch64/dl-irel.h
@@ -44,13 +44,15 @@ static inline ElfW(Addr)
__attribute ((always_inline))
elf_ifunc_invoke (ElfW(Addr) addr)
{
- __ifunc_arg_t arg;
-
- arg._size = sizeof (arg);
- arg._hwcap = GLRO(dl_hwcap);
- arg._hwcap2 = GLRO(dl_hwcap2);
- arg._hwcap3 = GLRO(dl_hwcap3);
- arg._hwcap4 = GLRO(dl_hwcap4);
+ static __ifunc_arg_t arg;
+ if (arg._size == 0)
+ {
+ arg._size = sizeof (arg);
+ arg._hwcap = GLRO(dl_hwcap);
+ arg._hwcap2 = GLRO(dl_hwcap2);
+ arg._hwcap3 = GLRO(dl_hwcap3);
+ arg._hwcap4 = GLRO(dl_hwcap4);
+ }
return ((ElfW(Addr) (*) (uint64_t, const __ifunc_arg_t *)) (addr))
(GLRO(dl_hwcap) | _IFUNC_ARG_HWCAP, &arg);
}
--
2.39.5
More information about the Libc-alpha
mailing list