summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 12ab22464..13dc33d17 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -771,6 +771,8 @@ dll_crt0_0 ()
disable_dep ();
#endif
+ _main_tls = &_my_tls;
+
/* Initialize signal processing here, early, in the hopes that the creation
of a thread early in the process will cause more predictability in memory
layout for the main thread. */
@@ -970,9 +972,11 @@ _dll_crt0 ()
{
main_environ = user_data->envptr;
if (in_forkee)
- fork_info->alloc_stack ();
+ {
+ fork_info->alloc_stack ();
+ _main_tls = &_my_tls;
+ }
- _main_tls = &_my_tls;
_main_tls->call ((DWORD (*) (void *, void *)) dll_crt0_1, NULL);
}