Remove plenty of makefile misconfigurations

This commit is contained in:
Justine Tunney 2022-07-21 09:16:38 -07:00
parent 9172fd42a0
commit 8b469389f6
186 changed files with 1408 additions and 901 deletions

View file

@ -59,7 +59,16 @@ extern unsigned char __tls_add_nt_rax[];
_Alignas(long) static char __static_tls[5008];
/**
* Enables thread local storage.
* Enables thread local storage for main process.
*
* %fs Linux/BSDs
*
* _Thread_local __get_tls()
*
* pad .tdata .tbss tib
*
*
* Windows/Mac %gs
*
* This function is always called by the core runtime to guarantee TLS
* is always available to your program. You must build your code using
@ -85,19 +94,6 @@ _Alignas(long) static char __static_tls[5008];
* and your `errno` variable also won't be thread safe anymore.
*/
privileged void __enable_tls(void) {
STRACE("__enable_tls()");
// allocate tls memory for main process
//
// %fs Linux/BSDs
// │
// _Thread_local │ __get_tls()
// ┌───┬──────────┬──────────┼───┐
// │pad│ .tdata │ .tbss │tib│
// └───┴──────────┴──────────┼───┘
// │
// Windows/Mac %gs
//
size_t siz;
cthread_t tib;
char *mem, *tls;
@ -179,11 +175,6 @@ privileged void __enable_tls(void) {
//
// 65 48 8b 0R4 25 30 00 00 00 mov %gs:0x30,%R
//
// Whereas on Windows we'll replace it with this:
//
// 0f 1f 40 00 fatnop4
// e8 xx xx xx xx call __tls_mov_nt_%R
//
// Since we have no idea where the TLS instructions exist in the
// binary, we need to disassemble the whole program image. This'll
// potentially take a few milliseconds for some larger programs.
@ -264,6 +255,5 @@ privileged void __enable_tls(void) {
}
// we are now allowed to use tls
// setting this variable
__tls_enabled = true;
}

View file

@ -17,7 +17,15 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
#include "libc/runtime/valist.h"
/* <sync libc/integral/lp64arg.inc> */
struct __va_list {
uint32_t gp_offset;
uint32_t fp_offset;
void *overflow_arg_area;
void *reg_save_area;
};
/* </sync libc/integral/lp64arg.inc> */
static void *__va_arg_mem(struct __va_list *ap, size_t sz, size_t align) {
void *r = (void *)ROUNDUP((intptr_t)ap->overflow_arg_area, align);

View file

@ -1,17 +0,0 @@
#ifndef COSMOPOLITAN_LIBC_RUNTIME_VALIST_H_
#define COSMOPOLITAN_LIBC_RUNTIME_VALIST_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct __va_list {
uint32_t gp_offset;
uint32_t fp_offset;
void *overflow_arg_area;
void *reg_save_area;
};
void *__va_arg(struct __va_list *, size_t, unsigned, unsigned);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_RUNTIME_VALIST_H_ */