about summary refs log tree commit diff
path: root/src/ldso/dynlink.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-10-07 21:43:46 -0400
committerRich Felker <dalias@aerifal.cx>2012-10-07 21:43:46 -0400
commit0a96a37f06fda78ce3674b425888b1fc090578aa (patch)
tree562b45acc1191a74bca5db876b44fd652678c94f /src/ldso/dynlink.c
parent017bf140ffb41e9a016df84dc4c1806e0686b28a (diff)
downloadmusl-0a96a37f06fda78ce3674b425888b1fc090578aa.tar.gz
musl-0a96a37f06fda78ce3674b425888b1fc090578aa.tar.xz
musl-0a96a37f06fda78ce3674b425888b1fc090578aa.zip
clean up and refactor program initialization
the code in __libc_start_main is now responsible for parsing auxv,
rather than duplicating the parsing all over the place. this should
shave off a few cycles and some code size. __init_libc is left as an
external-linkage function despite the fact that it could be static, to
prevent it from being inlined and permanently wasting stack space when
main is called.

a few other minor changes are included, like eliminating per-thread
ssp canaries (they were likely broken when combined with certain
dlopen usages, and completely unnecessary) and some other unnecessary
checks. since this code gets linked into every program, it should be
as small and simple as possible.
Diffstat (limited to 'src/ldso/dynlink.c')
-rw-r--r--src/ldso/dynlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 33ef7e55..c3cb6115 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -105,7 +105,7 @@ static pthread_mutex_t init_fini_lock = { ._m_type = PTHREAD_MUTEX_RECURSIVE };
 
 struct debug *_dl_debug_addr = &debug;
 
-#define AUX_CNT 24
+#define AUX_CNT 38
 #define DYN_CNT 34
 
 static void decode_vec(size_t *v, size_t *a, size_t cnt)
@@ -967,7 +967,7 @@ void *__dynlink(int argc, char **argv)
 	debug.state = 0;
 	_dl_debug_state();
 
-	if (ssp_used) __init_ssp(auxv);
+	if (ssp_used) __init_ssp((void *)aux[AT_RANDOM]);
 
 	atexit(do_fini);
 	do_init_fini(tail);