From f00e553e4b084007781df5e4b5accc2e152da231 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 19:41:29 +0100 Subject: add missing prototypes Add some missing prototypes Signed-off-by: Peter S. Mazinger --- libc/misc/internals/__uClibc_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libc/misc/internals/__uClibc_main.c') diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 58f6643b2..da29ef69e 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -313,6 +313,11 @@ void __uClibc_fini(void) } libc_hidden_def(__uClibc_fini) +#ifndef SHARED +extern void __nptl_deallocate_tsd (void) __attribute ((weak)); +extern unsigned int __nptl_nthreads __attribute ((weak)); +#endif + /* __uClibc_main is the new main stub for uClibc. This function is * called from crt1 (version 0.9.28 or newer), after ALL shared libraries * are initialized, just before we call the application's main function. @@ -481,7 +486,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, # ifdef SHARED __libc_pthread_functions.ptr__nptl_deallocate_tsd (); # else - extern void __nptl_deallocate_tsd (void) __attribute ((weak)); __nptl_deallocate_tsd (); # endif @@ -491,7 +495,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, # ifdef SHARED unsigned int *const ptr = __libc_pthread_functions.ptr_nthreads; # else - extern unsigned int __nptl_nthreads __attribute ((weak)); unsigned int *const ptr = &__nptl_nthreads; # endif -- cgit v1.2.3 From 2e9d2266c0cea250f7a87dc6aa2b02d0bd5a0aea Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 26 Feb 2011 21:49:38 +0100 Subject: Correct ssp code Avoid using strong_alias in ssp, some archs dislike it. Make stack_chk_guard static. Export __stack_smash_handler only if compatibility option is enabled. Signed-off-by: Peter S. Mazinger --- libc/misc/internals/__uClibc_main.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'libc/misc/internals/__uClibc_main.c') diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index da29ef69e..315365a25 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -45,22 +45,15 @@ void *__libc_stack_end = NULL; # ifdef __UCLIBC_HAS_SSP__ # include +static uintptr_t stack_chk_guard; # ifndef THREAD_SET_STACK_GUARD /* Only exported for architectures that don't store the stack guard canary * in thread local area. */ -# include -uintptr_t stack_chk_guard; /* for gcc-4.1 non-TLS */ uintptr_t __stack_chk_guard attribute_relro; +# endif /* for gcc-3.x + Etoh ssp */ -# ifdef __UCLIBC_HAS_SSP_COMPAT__ -# ifdef __HAVE_SHARED__ -strong_alias(__stack_chk_guard,__guard) -# else -uintptr_t __guard attribute_relro; -# endif -# endif -# elif defined __UCLIBC_HAS_SSP_COMPAT__ +# ifdef __UCLIBC_HAS_SSP_COMPAT__ uintptr_t __guard attribute_relro; # endif # endif @@ -251,18 +244,14 @@ void __uClibc_init(void) #ifndef SHARED # ifdef __UCLIBC_HAS_SSP__ /* Set up the stack checker's canary. */ + stack_chk_guard = _dl_setup_stack_chk_guard(); # ifdef THREAD_SET_STACK_GUARD - uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard(); THREAD_SET_STACK_GUARD (stack_chk_guard); -# ifdef __UCLIBC_HAS_SSP_COMPAT__ - stack_chk_guard = _dl_setup_stack_chk_guard(); - __guard = stack_chk_guard; -# endif # else __stack_chk_guard = stack_chk_guard; -# if !defined __HAVE_SHARED__ && defined __UCLIBC_HAS_SSP_COMPAT__ - __guard = stack_chk_guard; -# endif +# endif +# ifdef __UCLIBC_HAS_SSP_COMPAT__ + __guard = stack_chk_guard; # endif # endif #endif -- cgit v1.2.3