Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142740175
D54559.id169189.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54559.id169189.diff
View Options
diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -444,10 +444,23 @@
return (target);
}
+/* A second argument is passed to the ifunc resolver. */
+#define _IFUNC_ARG_HWCAP (1ULL << 62)
+
+unsigned long elf_hwcap;
+
+struct __ifunc_arg_t __ifunc_arg;
+
void
ifunc_init(Elf_Auxinfo *aux_info[__min_size(AT_COUNT)] __unused)
{
+ elf_hwcap = aux_info[AT_HWCAP]->a_un.a_val | _IFUNC_ARG_HWCAP;
+ __ifunc_arg._size = sizeof(__ifunc_arg);
+ __ifunc_arg._hwcap = elf_hwcap;
+ __ifunc_arg._hwcap2 = (aux_info[AT_HWCAP2] != NULL) ? aux_info[AT_HWCAP2]->a_un.a_val : 0;
+ __ifunc_arg._hwcap3 = (aux_info[AT_HWCAP3] != NULL) ? aux_info[AT_HWCAP3]->a_un.a_val : 0;
+ __ifunc_arg._hwcap4 = (aux_info[AT_HWCAP4] != NULL) ? aux_info[AT_HWCAP4]->a_un.a_val : 0;
}
/*
diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h
--- a/libexec/rtld-elf/aarch64/rtld_machdep.h
+++ b/libexec/rtld-elf/aarch64/rtld_machdep.h
@@ -67,6 +67,18 @@
#define call_init_pointer(obj, target) \
(((InitArrFunc)(target))(main_argc, main_argv, environ))
+struct __ifunc_arg_t
+{
+ unsigned long _size; /* Size of the struct, so it can grow. */
+ unsigned long _hwcap;
+ unsigned long _hwcap2;
+ unsigned long _hwcap3;
+ unsigned long _hwcap4;
+};
+
+extern u_long elf_hwcap;
+extern struct __ifunc_arg_t __ifunc_arg;
+
/*
* Pass zeros into the ifunc resolver so we can change them later. The first
* 8 arguments on arm64 are passed in registers so make them known values
@@ -76,7 +88,7 @@
*/
#define call_ifunc_resolver(ptr) \
(((Elf_Addr (*)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, \
- uint64_t, uint64_t, uint64_t))ptr)(0, 0, 0, 0, 0, 0, 0, 0))
+ uint64_t, uint64_t, uint64_t))ptr)(elf_hwcap, (uintptr_t)&__ifunc_arg, 0, 0, 0, 0, 0, 0))
#define round(size, align) \
(((size) + (align) - 1) & ~((align) - 1))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 23, 11:05 PM (13 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27891047
Default Alt Text
D54559.id169189.diff (1 KB)
Attached To
Mode
D54559: rtld-elf: Pass HWCAP flags to ifunc resolver functions
Attached
Detach File
Event Timeline
Log In to Comment