git: 33658afd4e4d - main - rtld-elf: Pass parsed aux_info to ifunc_init
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 22 Aug 2024 19:36:57 UTC
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=33658afd4e4d11cd71d92e52ca9da5381cdd829b
commit 33658afd4e4d11cd71d92e52ca9da5381cdd829b
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-08-22 19:36:44 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-08-22 19:36:44 +0000
rtld-elf: Pass parsed aux_info to ifunc_init
Currently we pass the raw pointer to the on-stack auxargs. This can
legitimately have fewer than AT_COUNT entries, so the use of
__min_size(AT_COUNT), i.e. static AT_COUNT, is inaccurate, and also
needlessly forces the callee to iterate over the elements to find the
entry for a given type. Instead we can just pass aux_info like we use
for everything else.
Note that the argument has been left unused by every callee since its
introduction in 4352999e0e6c ("Pass CPUID[1] %edx (cpu_feature), %ecx
(cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx
(cpu_stdext_feature2) to the ifunc resolvers on x86.")
Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D46276
---
libexec/rtld-elf/aarch64/reloc.c | 2 +-
libexec/rtld-elf/amd64/reloc.c | 2 +-
libexec/rtld-elf/arm/reloc.c | 2 +-
libexec/rtld-elf/i386/reloc.c | 2 +-
libexec/rtld-elf/powerpc/reloc.c | 2 +-
libexec/rtld-elf/powerpc64/reloc.c | 2 +-
libexec/rtld-elf/riscv/reloc.c | 2 +-
libexec/rtld-elf/rtld.c | 2 +-
libexec/rtld-elf/rtld.h | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c
index f76ce7f4d580..3687c9385326 100644
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -452,7 +452,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
}
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}
diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c
index 9c5887def356..2e24d6287ea3 100644
--- a/libexec/rtld-elf/amd64/reloc.c
+++ b/libexec/rtld-elf/amd64/reloc.c
@@ -499,7 +499,7 @@ reloc_gnu_ifunc(Obj_Entry *obj, int flags, RtldLockState *lockstate)
uint32_t cpu_feature, cpu_feature2, cpu_stdext_feature, cpu_stdext_feature2;
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
u_int p[4], cpu_high;
diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c
index 4683ebf74fee..b10e6ce844d5 100644
--- a/libexec/rtld-elf/arm/reloc.c
+++ b/libexec/rtld-elf/arm/reloc.c
@@ -442,7 +442,7 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
}
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}
diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c
index 04a8354343bc..c91239eb3989 100644
--- a/libexec/rtld-elf/i386/reloc.c
+++ b/libexec/rtld-elf/i386/reloc.c
@@ -464,7 +464,7 @@ rtld_cpuid_count(int idx, int cnt, u_int *p)
}
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
u_int p[4], cpu_high;
int cpuid_supported;
diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c
index 5618efb7f716..82a9669e3e73 100644
--- a/libexec/rtld-elf/powerpc/reloc.c
+++ b/libexec/rtld-elf/powerpc/reloc.c
@@ -813,7 +813,7 @@ powerpc_abi_variant_hook(Elf_Auxinfo** aux_info)
}
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}
diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c
index 2d06d5821d1b..70acd0ac390d 100644
--- a/libexec/rtld-elf/powerpc64/reloc.c
+++ b/libexec/rtld-elf/powerpc64/reloc.c
@@ -710,7 +710,7 @@ powerpc64_abi_variant_hook(Elf_Auxinfo** aux_info)
}
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}
diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c
index 43522a5a790f..5ea005a813cb 100644
--- a/libexec/rtld-elf/riscv/reloc.c
+++ b/libexec/rtld-elf/riscv/reloc.c
@@ -376,7 +376,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
}
void
-ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused)
+ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
}
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 1f0c59722ac6..a8db1198a899 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -904,7 +904,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
exit (0);
}
- ifunc_init(aux);
+ ifunc_init(aux_info);
/*
* Setup TLS for main thread. This must be done after the
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 656e980c6261..5527671d647e 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -438,7 +438,7 @@ int reloc_jmpslots(Obj_Entry *, int flags, struct Struct_RtldLockState *);
int reloc_iresolve(Obj_Entry *, struct Struct_RtldLockState *);
int reloc_iresolve_nonplt(Obj_Entry *, struct Struct_RtldLockState *);
int reloc_gnu_ifunc(Obj_Entry *, int flags, struct Struct_RtldLockState *);
-void ifunc_init(Elf_Auxinfo[__min_size(AT_COUNT)]);
+void ifunc_init(Elf_Auxinfo *[__min_size(AT_COUNT)]);
void init_pltgot(Obj_Entry *);
void allocate_initial_tls(Obj_Entry *);