Revert "Use %gs as TLS register when dlopen() is linked"

This reverts commit d71da7fc72.
This commit is contained in:
Justine Tunney 2023-11-08 01:33:01 -08:00
parent d71da7fc72
commit 956e68be59
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
13 changed files with 40 additions and 71 deletions

View file

@ -28,8 +28,6 @@
#include "libc/sysv/consts/o.h"
#include "libc/sysv/errfuns.h"
void sys_fcntl_nt_lock_cleanup(int);
textwindows int sys_close_nt(int fd, int fildes) {
if (fd + 0u >= g_fds.n) return ebadf();
struct Fd *f = g_fds.p + fd;
@ -37,6 +35,7 @@ textwindows int sys_close_nt(int fd, int fildes) {
case kFdEmpty:
return ebadf();
case kFdFile:
void sys_fcntl_nt_lock_cleanup(int);
if (_weaken(sys_fcntl_nt_lock_cleanup)) {
_weaken(sys_fcntl_nt_lock_cleanup)(fildes);
}

View file

@ -136,11 +136,10 @@ static inline void InitProgramExecutableNameImpl(void) {
}
// give up and just copy argv[0] into it
char *p, *e;
if ((q = __argv[0])) {
CopyString:
p = g_prog.u.buf;
e = p + sizeof(g_prog.u.buf);
char *p = g_prog.u.buf;
char *e = p + sizeof(g_prog.u.buf);
while ((c = *q++)) {
if (p + 1 < e) {
*p++ = c;

View file

@ -35,7 +35,6 @@ static textwindows int _park_thread(uint32_t msdelay, sigset_t waitmask,
if ((sig = __sig_get(waitmask))) goto HandleSignal;
int expect = 0;
atomic_int futex = 0;
int handler_was_called;
struct PosixThread *pt = _pthread_self();
pt->pt_blkmask = waitmask;
atomic_store_explicit(&pt->pt_blocker, &futex, memory_order_release);
@ -43,7 +42,7 @@ static textwindows int _park_thread(uint32_t msdelay, sigset_t waitmask,
atomic_store_explicit(&pt->pt_blocker, 0, memory_order_release);
if (ok && (sig = __sig_get(waitmask))) {
HandleSignal:
handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
int handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
if (_check_cancel() == -1) return -1;
if (!restartable || (handler_was_called & SIG_HANDLED_NO_RESTART)) {
return eintr();

View file

@ -723,7 +723,6 @@ static textwindows int WaitForConsole(struct Fd *f, sigset_t waitmask) {
int sig;
int64_t sem;
uint32_t wi, ms = -1;
int handler_was_called;
if (!__ttyconf.vmin) {
if (!__ttyconf.vtime) {
return 0; // non-blocking w/o raising eagain
@ -746,7 +745,7 @@ static textwindows int WaitForConsole(struct Fd *f, sigset_t waitmask) {
if (wi != 1) return __winerr(); // wait failed
if (!(sig = __sig_get(waitmask))) return eintr();
DeliverSignal:
handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
int handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
if (_check_cancel() == -1) return -1;
if (!(handler_was_called & SIG_HANDLED_NO_RESTART)) return -2;
return eintr();

View file

@ -47,9 +47,7 @@ sys_readwrite_nt(int fd, void *data, size_t size, ssize_t offset,
bool32 ReadOrWriteFile(int64_t, void *, uint32_t, uint32_t *,
struct NtOverlapped *)) {
int sig;
bool eagained;
uint32_t exchanged;
int handler_was_called;
struct Fd *f = g_fds.p + fd;
// win32 i/o apis generally take 32-bit values thus we implicitly
@ -81,7 +79,7 @@ sys_readwrite_nt(int fd, void *data, size_t size, ssize_t offset,
}
RestartOperation:
eagained = false;
bool eagained = false;
// check for signals and cancelation
if (_check_cancel() == -1) return -1; // ECANCELED
if ((sig = __sig_get(waitmask))) goto HandleInterrupt;
@ -134,7 +132,7 @@ RestartOperation:
// otherwise it must be due to a kill() via __sig_cancel()
if ((sig = __sig_get(waitmask))) {
HandleInterrupt:
handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
int handler_was_called = __sig_relay(sig, SI_KERNEL, waitmask);
if (_check_cancel() == -1) return -1; // possible if we SIGTHR'd
// read() is @restartable unless non-SA_RESTART hands were called
if (!(handler_was_called & SIG_HANDLED_NO_RESTART)) {