From 4158ba082c641f407009363b186b4c85f8a01a35 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 31 May 2017 06:38:32 +0530 Subject: Delay initialization of CPU features struct in static binaries Allow the CPU features structure set up to be overridden by tunables by delaying it to until after tunables are initialized. The initialization is already delayed in dynamically linked glibc, it is only in static binaries that the initialization is set early to allow it to influence IFUNC relocations that happen in libc-start. It is a bit too early however and there is a good place between tunables initialization and IFUNC relocations where this can be done. Verified that this does not regress the testsuite. * csu/libc-start.c [!ARCH_INIT_CPU_FEATURES]: Define ARCH_INIT_CPU_FEATURES. (LIBC_START_MAIN): Call it. * sysdeps/unix/sysv/linux/aarch64/libc-start.c (__libc_start_main): Remove. (ARCH_INIT_CPU_FEATURES): New macro. * sysdeps/x86/libc-start.c (__libc_start_main): Remove. (ARCH_INIT_CPU_FEATURES): New macro. --- sysdeps/unix/sysv/linux/aarch64/libc-start.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'sysdeps/unix/sysv/linux/aarch64/libc-start.c') diff --git a/sysdeps/unix/sysv/linux/aarch64/libc-start.c b/sysdeps/unix/sysv/linux/aarch64/libc-start.c index a5babd49ea..089a728a87 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc-start.c +++ b/sysdeps/unix/sysv/linux/aarch64/libc-start.c @@ -16,26 +16,13 @@ License along with the GNU C Library; if not, see . */ -#ifdef SHARED -# include -# else -/* The main work is done in the generic function. */ -# define LIBC_START_DISABLE_INLINE -# define LIBC_START_MAIN generic_start_main -# include +#ifndef SHARED +# include # include extern struct cpu_features _dl_aarch64_cpu_features; -int -__libc_start_main (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), - int argc, char **argv, - __typeof (main) init, - void (*fini) (void), - void (*rtld_fini) (void), void *stack_end) -{ - init_cpu_features (&_dl_aarch64_cpu_features); - return generic_start_main (main, argc, argv, init, fini, rtld_fini, - stack_end); -} +# define ARCH_INIT_CPU_FEATURES() init_cpu_features (&_dl_aarch64_cpu_features) + #endif +#include -- cgit 1.4.1