From b3516058eb9ff9e52a8720f0e5c0f6936cce6047 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 13 Oct 2017 10:39:51 -0400 Subject: for executing init array functions, use function type with prototype this is for consistency with the way it's done in in the dynamic linker, avoiding a deprecated C feature (non-prototype function types), and improving code generation. GCC unnecessarily uses the variadic calling convention (e.g. clearing rax on x86_64) when making a call where the argument types are not known for compatibility with wrong code which calls variadic functions this way. (C on the other hand is clear that such calls have undefined behavior.) --- src/env/__libc_start_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/env') diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c index 18afdc1d..2d758af7 100644 --- a/src/env/__libc_start_main.c +++ b/src/env/__libc_start_main.c @@ -58,7 +58,7 @@ static void libc_start_init(void) _init(); uintptr_t a = (uintptr_t)&__init_array_start; for (; a<(uintptr_t)&__init_array_end; a+=sizeof(void(*)())) - (*(void (**)())a)(); + (*(void (**)(void))a)(); } weak_alias(libc_start_init, __libc_start_init); -- cgit v1.2.1