diff options
author | 2013-12-12 08:12:08 +0000 | |
---|---|---|
committer | 2013-12-12 08:12:08 +0000 | |
commit | 601355ee8401e35bb31c2066a5188e33c2d5ce90 (patch) | |
tree | 17fef858a7ad751dab0aa694638ad9d9a19eeb6e /lib/csu | |
parent | Set the d_off member as getdents() expects in ntfs_readdir() (diff) | |
download | wireguard-openbsd-601355ee8401e35bb31c2066a5188e33c2d5ce90.tar.xz wireguard-openbsd-601355ee8401e35bb31c2066a5188e33c2d5ce90.zip |
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')
-rw-r--r-- | lib/csu/common_elf/crt0.c | 7 | ||||
-rw-r--r-- | lib/csu/crt0.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/csu/common_elf/crt0.c b/lib/csu/common_elf/crt0.c index 32cbe4c1f87..aaef64a7a57 100644 --- a/lib/csu/common_elf/crt0.c +++ b/lib/csu/common_elf/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); 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); |