Cygwin: switch to _REENT_GLOBAL_STDIO_STREAMS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-05-13 13:26:54 +02:00
parent 01c823efb7
commit d02421e7f7
5 changed files with 219 additions and 230 deletions

View File

@ -55,16 +55,8 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *))
_REENT_INIT_PTR (&local_clib);
stackptr = stack;
altstack.ss_flags = SS_DISABLE;
if (_GLOBAL_REENT)
{
local_clib._stdin = _GLOBAL_REENT->_stdin;
local_clib._stdout = _GLOBAL_REENT->_stdout;
local_clib._stderr = _GLOBAL_REENT->_stderr;
if (_GLOBAL_REENT->__cleanup)
local_clib.__cleanup = _cygtls::cleanup_early;
local_clib.__sglue._niobs = 3;
local_clib.__sglue._iobs = &_GLOBAL_REENT->__sf[0];
}
if (_GLOBAL_REENT->__cleanup)
local_clib.__cleanup = _cygtls::cleanup_early;
}
thread_id = GetCurrentThreadId ();

View File

@ -756,10 +756,6 @@ dll_crt0_0 ()
SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
lock_process::init ();
_impure_ptr = _GLOBAL_REENT;
_impure_ptr->_stdin = &_impure_ptr->__sf[0];
_impure_ptr->_stdout = &_impure_ptr->__sf[1];
_impure_ptr->_stderr = &_impure_ptr->__sf[2];
user_data->impure_ptr = _impure_ptr;
user_data->impure_ptr_ptr = &_impure_ptr;

View File

@ -66,6 +66,7 @@ extern inline struct _reent *__getreent (void)
/* The following block of macros is required to build newlib correctly for
Cygwin. Changing them in applications has no or not the desired effect.
Just leave them alone. */
#define _REENT_GLOBAL_STDIO_STREAMS 1
#define _READ_WRITE_RETURN_TYPE _ssize_t
#define _READ_WRITE_BUFSIZE_TYPE size_t
#define __LARGE64_FILES 1

View File

@ -7,60 +7,60 @@
//; $tls::plocal_clib = 1720;
//; $tls::__dontuse = -10980;
//; $tls::p__dontuse = 1720;
//; $tls::func = -9892;
//; $tls::pfunc = 2808;
//; $tls::saved_errno = -9888;
//; $tls::psaved_errno = 2812;
//; $tls::sa_flags = -9884;
//; $tls::psa_flags = 2816;
//; $tls::oldmask = -9880;
//; $tls::poldmask = 2820;
//; $tls::deltamask = -9876;
//; $tls::pdeltamask = 2824;
//; $tls::errno_addr = -9872;
//; $tls::perrno_addr = 2828;
//; $tls::sigmask = -9868;
//; $tls::psigmask = 2832;
//; $tls::sigwait_mask = -9864;
//; $tls::psigwait_mask = 2836;
//; $tls::altstack = -9860;
//; $tls::paltstack = 2840;
//; $tls::sigwait_info = -9848;
//; $tls::psigwait_info = 2852;
//; $tls::signal_arrived = -9844;
//; $tls::psignal_arrived = 2856;
//; $tls::will_wait_for_signal = -9840;
//; $tls::pwill_wait_for_signal = 2860;
//; $tls::__align = -9836;
//; $tls::p__align = 2864;
//; $tls::context = -9832;
//; $tls::pcontext = 2868;
//; $tls::thread_id = -9084;
//; $tls::pthread_id = 3616;
//; $tls::infodata = -9080;
//; $tls::pinfodata = 3620;
//; $tls::tid = -8932;
//; $tls::ptid = 3768;
//; $tls::_ctinfo = -8928;
//; $tls::p_ctinfo = 3772;
//; $tls::andreas = -8924;
//; $tls::pandreas = 3776;
//; $tls::wq = -8920;
//; $tls::pwq = 3780;
//; $tls::sig = -8892;
//; $tls::psig = 3808;
//; $tls::incyg = -8888;
//; $tls::pincyg = 3812;
//; $tls::spinning = -8884;
//; $tls::pspinning = 3816;
//; $tls::stacklock = -8880;
//; $tls::pstacklock = 3820;
//; $tls::stackptr = -8876;
//; $tls::pstackptr = 3824;
//; $tls::stack = -8872;
//; $tls::pstack = 3828;
//; $tls::initialized = -7848;
//; $tls::pinitialized = 4852;
//; $tls::func = -10244;
//; $tls::pfunc = 2456;
//; $tls::saved_errno = -10240;
//; $tls::psaved_errno = 2460;
//; $tls::sa_flags = -10236;
//; $tls::psa_flags = 2464;
//; $tls::oldmask = -10232;
//; $tls::poldmask = 2468;
//; $tls::deltamask = -10228;
//; $tls::pdeltamask = 2472;
//; $tls::errno_addr = -10224;
//; $tls::perrno_addr = 2476;
//; $tls::sigmask = -10220;
//; $tls::psigmask = 2480;
//; $tls::sigwait_mask = -10216;
//; $tls::psigwait_mask = 2484;
//; $tls::altstack = -10212;
//; $tls::paltstack = 2488;
//; $tls::sigwait_info = -10200;
//; $tls::psigwait_info = 2500;
//; $tls::signal_arrived = -10196;
//; $tls::psignal_arrived = 2504;
//; $tls::will_wait_for_signal = -10192;
//; $tls::pwill_wait_for_signal = 2508;
//; $tls::__align = -10188;
//; $tls::p__align = 2512;
//; $tls::context = -10184;
//; $tls::pcontext = 2516;
//; $tls::thread_id = -9436;
//; $tls::pthread_id = 3264;
//; $tls::infodata = -9432;
//; $tls::pinfodata = 3268;
//; $tls::tid = -9284;
//; $tls::ptid = 3416;
//; $tls::_ctinfo = -9280;
//; $tls::p_ctinfo = 3420;
//; $tls::andreas = -9276;
//; $tls::pandreas = 3424;
//; $tls::wq = -9272;
//; $tls::pwq = 3428;
//; $tls::sig = -9244;
//; $tls::psig = 3456;
//; $tls::incyg = -9240;
//; $tls::pincyg = 3460;
//; $tls::spinning = -9236;
//; $tls::pspinning = 3464;
//; $tls::stacklock = -9232;
//; $tls::pstacklock = 3468;
//; $tls::stackptr = -9228;
//; $tls::pstackptr = 3472;
//; $tls::stack = -9224;
//; $tls::pstack = 3476;
//; $tls::initialized = -8200;
//; $tls::pinitialized = 4500;
//; __DATA__
#define tls_locals (-12700)
@ -69,57 +69,57 @@
#define tls_plocal_clib (1720)
#define tls___dontuse (-10980)
#define tls_p__dontuse (1720)
#define tls_func (-9892)
#define tls_pfunc (2808)
#define tls_saved_errno (-9888)
#define tls_psaved_errno (2812)
#define tls_sa_flags (-9884)
#define tls_psa_flags (2816)
#define tls_oldmask (-9880)
#define tls_poldmask (2820)
#define tls_deltamask (-9876)
#define tls_pdeltamask (2824)
#define tls_errno_addr (-9872)
#define tls_perrno_addr (2828)
#define tls_sigmask (-9868)
#define tls_psigmask (2832)
#define tls_sigwait_mask (-9864)
#define tls_psigwait_mask (2836)
#define tls_altstack (-9860)
#define tls_paltstack (2840)
#define tls_sigwait_info (-9848)
#define tls_psigwait_info (2852)
#define tls_signal_arrived (-9844)
#define tls_psignal_arrived (2856)
#define tls_will_wait_for_signal (-9840)
#define tls_pwill_wait_for_signal (2860)
#define tls___align (-9836)
#define tls_p__align (2864)
#define tls_context (-9832)
#define tls_pcontext (2868)
#define tls_thread_id (-9084)
#define tls_pthread_id (3616)
#define tls_infodata (-9080)
#define tls_pinfodata (3620)
#define tls_tid (-8932)
#define tls_ptid (3768)
#define tls__ctinfo (-8928)
#define tls_p_ctinfo (3772)
#define tls_andreas (-8924)
#define tls_pandreas (3776)
#define tls_wq (-8920)
#define tls_pwq (3780)
#define tls_sig (-8892)
#define tls_psig (3808)
#define tls_incyg (-8888)
#define tls_pincyg (3812)
#define tls_spinning (-8884)
#define tls_pspinning (3816)
#define tls_stacklock (-8880)
#define tls_pstacklock (3820)
#define tls_stackptr (-8876)
#define tls_pstackptr (3824)
#define tls_stack (-8872)
#define tls_pstack (3828)
#define tls_initialized (-7848)
#define tls_pinitialized (4852)
#define tls_func (-10244)
#define tls_pfunc (2456)
#define tls_saved_errno (-10240)
#define tls_psaved_errno (2460)
#define tls_sa_flags (-10236)
#define tls_psa_flags (2464)
#define tls_oldmask (-10232)
#define tls_poldmask (2468)
#define tls_deltamask (-10228)
#define tls_pdeltamask (2472)
#define tls_errno_addr (-10224)
#define tls_perrno_addr (2476)
#define tls_sigmask (-10220)
#define tls_psigmask (2480)
#define tls_sigwait_mask (-10216)
#define tls_psigwait_mask (2484)
#define tls_altstack (-10212)
#define tls_paltstack (2488)
#define tls_sigwait_info (-10200)
#define tls_psigwait_info (2500)
#define tls_signal_arrived (-10196)
#define tls_psignal_arrived (2504)
#define tls_will_wait_for_signal (-10192)
#define tls_pwill_wait_for_signal (2508)
#define tls___align (-10188)
#define tls_p__align (2512)
#define tls_context (-10184)
#define tls_pcontext (2516)
#define tls_thread_id (-9436)
#define tls_pthread_id (3264)
#define tls_infodata (-9432)
#define tls_pinfodata (3268)
#define tls_tid (-9284)
#define tls_ptid (3416)
#define tls__ctinfo (-9280)
#define tls_p_ctinfo (3420)
#define tls_andreas (-9276)
#define tls_pandreas (3424)
#define tls_wq (-9272)
#define tls_pwq (3428)
#define tls_sig (-9244)
#define tls_psig (3456)
#define tls_incyg (-9240)
#define tls_pincyg (3460)
#define tls_spinning (-9236)
#define tls_pspinning (3464)
#define tls_stacklock (-9232)
#define tls_pstacklock (3468)
#define tls_stackptr (-9228)
#define tls_pstackptr (3472)
#define tls_stack (-9224)
#define tls_pstack (3476)
#define tls_initialized (-8200)
#define tls_pinitialized (4500)

View File

@ -7,60 +7,60 @@
//; $tls::plocal_clib = 2176;
//; $tls::__dontuse = -10624;
//; $tls::p__dontuse = 2176;
//; $tls::func = -8736;
//; $tls::pfunc = 4064;
//; $tls::saved_errno = -8728;
//; $tls::psaved_errno = 4072;
//; $tls::sa_flags = -8724;
//; $tls::psa_flags = 4076;
//; $tls::oldmask = -8720;
//; $tls::poldmask = 4080;
//; $tls::deltamask = -8712;
//; $tls::pdeltamask = 4088;
//; $tls::errno_addr = -8704;
//; $tls::perrno_addr = 4096;
//; $tls::sigmask = -8696;
//; $tls::psigmask = 4104;
//; $tls::sigwait_mask = -8688;
//; $tls::psigwait_mask = 4112;
//; $tls::altstack = -8680;
//; $tls::paltstack = 4120;
//; $tls::sigwait_info = -8656;
//; $tls::psigwait_info = 4144;
//; $tls::signal_arrived = -8648;
//; $tls::psignal_arrived = 4152;
//; $tls::will_wait_for_signal = -8640;
//; $tls::pwill_wait_for_signal = 4160;
//; $tls::__align = -8632;
//; $tls::p__align = 4168;
//; $tls::context = -8624;
//; $tls::pcontext = 4176;
//; $tls::thread_id = -7328;
//; $tls::pthread_id = 5472;
//; $tls::infodata = -7324;
//; $tls::pinfodata = 5476;
//; $tls::tid = -7176;
//; $tls::ptid = 5624;
//; $tls::_ctinfo = -7168;
//; $tls::p_ctinfo = 5632;
//; $tls::andreas = -7160;
//; $tls::pandreas = 5640;
//; $tls::wq = -7152;
//; $tls::pwq = 5648;
//; $tls::sig = -7104;
//; $tls::psig = 5696;
//; $tls::incyg = -7100;
//; $tls::pincyg = 5700;
//; $tls::spinning = -7096;
//; $tls::pspinning = 5704;
//; $tls::stacklock = -7092;
//; $tls::pstacklock = 5708;
//; $tls::stackptr = -7088;
//; $tls::pstackptr = 5712;
//; $tls::stack = -7080;
//; $tls::pstack = 5720;
//; $tls::initialized = -5032;
//; $tls::pinitialized = 7768;
//; $tls::func = -9312;
//; $tls::pfunc = 3488;
//; $tls::saved_errno = -9304;
//; $tls::psaved_errno = 3496;
//; $tls::sa_flags = -9300;
//; $tls::psa_flags = 3500;
//; $tls::oldmask = -9296;
//; $tls::poldmask = 3504;
//; $tls::deltamask = -9288;
//; $tls::pdeltamask = 3512;
//; $tls::errno_addr = -9280;
//; $tls::perrno_addr = 3520;
//; $tls::sigmask = -9272;
//; $tls::psigmask = 3528;
//; $tls::sigwait_mask = -9264;
//; $tls::psigwait_mask = 3536;
//; $tls::altstack = -9256;
//; $tls::paltstack = 3544;
//; $tls::sigwait_info = -9232;
//; $tls::psigwait_info = 3568;
//; $tls::signal_arrived = -9224;
//; $tls::psignal_arrived = 3576;
//; $tls::will_wait_for_signal = -9216;
//; $tls::pwill_wait_for_signal = 3584;
//; $tls::__align = -9208;
//; $tls::p__align = 3592;
//; $tls::context = -9200;
//; $tls::pcontext = 3600;
//; $tls::thread_id = -7904;
//; $tls::pthread_id = 4896;
//; $tls::infodata = -7900;
//; $tls::pinfodata = 4900;
//; $tls::tid = -7752;
//; $tls::ptid = 5048;
//; $tls::_ctinfo = -7744;
//; $tls::p_ctinfo = 5056;
//; $tls::andreas = -7736;
//; $tls::pandreas = 5064;
//; $tls::wq = -7728;
//; $tls::pwq = 5072;
//; $tls::sig = -7680;
//; $tls::psig = 5120;
//; $tls::incyg = -7676;
//; $tls::pincyg = 5124;
//; $tls::spinning = -7672;
//; $tls::pspinning = 5128;
//; $tls::stacklock = -7668;
//; $tls::pstacklock = 5132;
//; $tls::stackptr = -7664;
//; $tls::pstackptr = 5136;
//; $tls::stack = -7656;
//; $tls::pstack = 5144;
//; $tls::initialized = -5608;
//; $tls::pinitialized = 7192;
//; __DATA__
#define tls_locals (-12800)
@ -69,57 +69,57 @@
#define tls_plocal_clib (2176)
#define tls___dontuse (-10624)
#define tls_p__dontuse (2176)
#define tls_func (-8736)
#define tls_pfunc (4064)
#define tls_saved_errno (-8728)
#define tls_psaved_errno (4072)
#define tls_sa_flags (-8724)
#define tls_psa_flags (4076)
#define tls_oldmask (-8720)
#define tls_poldmask (4080)
#define tls_deltamask (-8712)
#define tls_pdeltamask (4088)
#define tls_errno_addr (-8704)
#define tls_perrno_addr (4096)
#define tls_sigmask (-8696)
#define tls_psigmask (4104)
#define tls_sigwait_mask (-8688)
#define tls_psigwait_mask (4112)
#define tls_altstack (-8680)
#define tls_paltstack (4120)
#define tls_sigwait_info (-8656)
#define tls_psigwait_info (4144)
#define tls_signal_arrived (-8648)
#define tls_psignal_arrived (4152)
#define tls_will_wait_for_signal (-8640)
#define tls_pwill_wait_for_signal (4160)
#define tls___align (-8632)
#define tls_p__align (4168)
#define tls_context (-8624)
#define tls_pcontext (4176)
#define tls_thread_id (-7328)
#define tls_pthread_id (5472)
#define tls_infodata (-7324)
#define tls_pinfodata (5476)
#define tls_tid (-7176)
#define tls_ptid (5624)
#define tls__ctinfo (-7168)
#define tls_p_ctinfo (5632)
#define tls_andreas (-7160)
#define tls_pandreas (5640)
#define tls_wq (-7152)
#define tls_pwq (5648)
#define tls_sig (-7104)
#define tls_psig (5696)
#define tls_incyg (-7100)
#define tls_pincyg (5700)
#define tls_spinning (-7096)
#define tls_pspinning (5704)
#define tls_stacklock (-7092)
#define tls_pstacklock (5708)
#define tls_stackptr (-7088)
#define tls_pstackptr (5712)
#define tls_stack (-7080)
#define tls_pstack (5720)
#define tls_initialized (-5032)
#define tls_pinitialized (7768)
#define tls_func (-9312)
#define tls_pfunc (3488)
#define tls_saved_errno (-9304)
#define tls_psaved_errno (3496)
#define tls_sa_flags (-9300)
#define tls_psa_flags (3500)
#define tls_oldmask (-9296)
#define tls_poldmask (3504)
#define tls_deltamask (-9288)
#define tls_pdeltamask (3512)
#define tls_errno_addr (-9280)
#define tls_perrno_addr (3520)
#define tls_sigmask (-9272)
#define tls_psigmask (3528)
#define tls_sigwait_mask (-9264)
#define tls_psigwait_mask (3536)
#define tls_altstack (-9256)
#define tls_paltstack (3544)
#define tls_sigwait_info (-9232)
#define tls_psigwait_info (3568)
#define tls_signal_arrived (-9224)
#define tls_psignal_arrived (3576)
#define tls_will_wait_for_signal (-9216)
#define tls_pwill_wait_for_signal (3584)
#define tls___align (-9208)
#define tls_p__align (3592)
#define tls_context (-9200)
#define tls_pcontext (3600)
#define tls_thread_id (-7904)
#define tls_pthread_id (4896)
#define tls_infodata (-7900)
#define tls_pinfodata (4900)
#define tls_tid (-7752)
#define tls_ptid (5048)
#define tls__ctinfo (-7744)
#define tls_p_ctinfo (5056)
#define tls_andreas (-7736)
#define tls_pandreas (5064)
#define tls_wq (-7728)
#define tls_pwq (5072)
#define tls_sig (-7680)
#define tls_psig (5120)
#define tls_incyg (-7676)
#define tls_pincyg (5124)
#define tls_spinning (-7672)
#define tls_pspinning (5128)
#define tls_stacklock (-7668)
#define tls_pstacklock (5132)
#define tls_stackptr (-7664)
#define tls_pstackptr (5136)
#define tls_stack (-7656)
#define tls_pstack (5144)
#define tls_initialized (-5608)
#define tls_pinitialized (7192)