summaryrefslogtreecommitdiff
path: root/libc/misc/internals
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-02-18 08:34:59 +0000
committerEric Andersen <andersen@codepoet.org>2002-02-18 08:34:59 +0000
commit5305b3df0ac3b6970947180fa9b2fcad0b6e6364 (patch)
tree4d4e390fd0f8b77e73e3e96542956df47582b3b5 /libc/misc/internals
parentdc3cbf11415312c6a28dc8c652ee2bec7e6a6f8e (diff)
Support strong_alias and begin merging usage of weak_function
Diffstat (limited to 'libc/misc/internals')
-rw-r--r--libc/misc/internals/__uClibc_main.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index ad17d7940..b6addb9c8 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -19,19 +19,22 @@
*/
extern int main(int argc, char **argv, char **envp);
-extern void __uClibc_empty_func(void);
void __uClibc_main(int argc, char **argv, char **envp)
__attribute__ ((__noreturn__));
+
+
#ifdef HAVE_ELF
weak_alias(__environ, environ);
-weak_symbol(__init_stdio);
-weak_symbol(__stdio_close_all);
-#endif
-
+extern void weak_function __init_stdio(void);
+extern void weak_function __stdio_close_all(void);
+extern void weak_function __pthread_initialize_minimal (void);
+#else
extern void __init_stdio(void);
extern void __stdio_close_all(void);
+extern void __pthread_initialize_minimal (void);
+#endif
typedef void (*vfuncp) (void);
vfuncp __uClibc_cleanup = __stdio_close_all;
@@ -47,6 +50,19 @@ void __uClibc_main(int argc, char **argv, char **envp)
*/
__environ = envp;
+ /* Initialize the thread library at least a bit so at least
+ * errno will be properly setup */
+ if (__pthread_initialize_minimal)
+ __pthread_initialize_minimal ();
+
+#if 0
+ /* Some security at this point. Prevent starting a SUID binary
+ * where the standard file descriptors are not opened. We have
+ * to do this only for statically linked applications since
+ * otherwise the dynamic loader did the work already. */
+ if (__builtin_expect (__libc_enable_secure, 0))
+ __libc_check_standard_fds ();
+#endif
/*
* Initialize stdio here. In the static library case, this will
* be bypassed if not needed because of the weak alias above.
@@ -85,11 +101,12 @@ char **__environ = 0;
* NOTE!!! This is only true for the _static_ case!!!
*/
+weak_alias(__environ, environ);
+#if 0
void __uClibc_empty_func(void)
{
}
-
-weak_alias(__environ, environ);
-/*weak_alias(__uClibc_empty_func, __init_stdio);*/
-/*weak_alias(__uClibc_empty_func, __stdio_close_all);*/
+weak_alias(__uClibc_empty_func, __init_stdio);
+weak_alias(__uClibc_empty_func, __stdio_close_all);
+#endif
#endif