Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Dec 2025 17:00:03 +0000
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d5d8583a16ef - stable/14 - rtld-elf: Pass parsed aux_info to ifunc_init
Message-ID:  <69403e93.dda4.50e105fe@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=d5d8583a16ef533dfd8e1164401c4960417014ad

commit d5d8583a16ef533dfd8e1164401c4960417014ad
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-08-22 19:36:44 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2025-12-15 16:58:43 +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
    
    (cherry picked from commit 33658afd4e4d11cd71d92e52ca9da5381cdd829b)
---
 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 828686af8b98..c65b5dd431a0 100644
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -352,7 +352,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 e46f6bc2e9b5..134506ae3854 100644
--- a/libexec/rtld-elf/amd64/reloc.c
+++ b/libexec/rtld-elf/amd64/reloc.c
@@ -497,7 +497,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 6efc9f499761..6bcfaa507505 100644
--- a/libexec/rtld-elf/arm/reloc.c
+++ b/libexec/rtld-elf/arm/reloc.c
@@ -443,7 +443,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 361bb777315a..24c754865504 100644
--- a/libexec/rtld-elf/i386/reloc.c
+++ b/libexec/rtld-elf/i386/reloc.c
@@ -462,7 +462,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 73a1c89991e2..859991cbe27f 100644
--- a/libexec/rtld-elf/powerpc/reloc.c
+++ b/libexec/rtld-elf/powerpc/reloc.c
@@ -802,7 +802,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 70928829aeda..71b7a361f0df 100644
--- a/libexec/rtld-elf/powerpc64/reloc.c
+++ b/libexec/rtld-elf/powerpc64/reloc.c
@@ -699,7 +699,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 d806e1ec3d63..2b254803fabf 100644
--- a/libexec/rtld-elf/riscv/reloc.c
+++ b/libexec/rtld-elf/riscv/reloc.c
@@ -377,7 +377,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 a49d2a6301d2..8509321b785f 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -918,7 +918,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 8d0b8bfed2ab..527ecf9d84e7 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -446,7 +446,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 *);
 


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69403e93.dda4.50e105fe>