diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-12-12 08:12:09 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-12-12 08:12:09 +0000 |
commit | 90aa35af34f1764d881c3f88bbcf26688d2694c0 (patch) | |
tree | 57a3c4b912fbaf951ef5862f05c11d203495bc81 /lib/csu/crt0.c | |
parent | 9344f94d7092717b33289aabde71d74429db5ad2 (diff) |
Fix static linking of libpthread: have crt0 invoke __init_tcb() if it's
defined and we don't think ld.so has already done the TCB setup.
ok and much discussion miod@
Diffstat (limited to 'lib/csu/crt0.c')
-rw-r--r-- | lib/csu/crt0.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/csu/crt0.c b/lib/csu/crt0.c index 32cbe4c1f87..aaef64a7a57 100644 --- a/lib/csu/crt0.c +++ b/lib/csu/crt0.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crt0.c,v 1.1 2013/12/03 06:21:40 guenther Exp $ */ +/* $OpenBSD: crt0.c,v 1.2 2013/12/12 08:12:08 guenther Exp $ */ /* * Copyright (c) 1995 Christopher G. Demetriou @@ -49,6 +49,8 @@ static void ___start(MD_START_ARGS) __used; #define MD_EPROL_LABEL __asm(" .text\n_eprol:") #endif +void __init_tcb(char **_envp); +#pragma weak __init_tcb static char *_strrchr(char *, char); @@ -91,7 +93,10 @@ MD_START(MD_START_ARGS) #ifndef MD_NO_CLEANUP if (cleanup != NULL) atexit(cleanup); + else #endif + if (__init_tcb != NULL) + __init_tcb(envp); #ifdef MCRT0 atexit(_mcleanup); |