mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Get cosmo_dlopen() working better on System Five
Imported functions are now aspected with a trampoline that blocks signals and changes the thread-local storage register. This means bigger more complicated libraries can now be imported even though the whole technique remains fundamentally unsafe.
This commit is contained in:
parent
3a470ed356
commit
e4584ace81
6 changed files with 304 additions and 190 deletions
|
@ -471,7 +471,6 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
|
|||
p = b;
|
||||
f = fmt;
|
||||
e = p + n; // assume if n was negative e < p will be the case
|
||||
tib = __tls_enabled ? __get_tls_privileged() : 0;
|
||||
for (;;) {
|
||||
for (;;) {
|
||||
if (!(c = *f++) || c == '%') break;
|
||||
|
@ -582,6 +581,7 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
|
|||
goto FormatUnsigned;
|
||||
|
||||
case 'P':
|
||||
tib = __tls_enabled ? __get_tls_privileged() : 0;
|
||||
if (!(tib && (tib->tib_flags & TIB_FLAG_VFORKED))) {
|
||||
x = __pid;
|
||||
#ifdef __x86_64__
|
||||
|
@ -607,6 +607,7 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
|
|||
goto FormatDecimal;
|
||||
|
||||
case 'H':
|
||||
tib = __tls_enabled ? __get_tls_privileged() : 0;
|
||||
if (!(tib && (tib->tib_flags & TIB_FLAG_VFORKED))) {
|
||||
if (tib) {
|
||||
x = atomic_load_explicit(&tib->tib_tid, memory_order_relaxed);
|
||||
|
@ -760,6 +761,7 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
|
|||
|
||||
case 'm': {
|
||||
int e;
|
||||
tib = __tls_enabled ? __get_tls_privileged() : 0;
|
||||
if (!(e = tib ? tib->tib_errno : __errno) && sign == ' ') {
|
||||
break;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue