Get GCC to mostly build with Cosmo

This commit is contained in:
Justine Tunney 2023-06-09 06:41:34 -07:00
parent 2eb7148474
commit 9b55dbe417
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
54 changed files with 113 additions and 132 deletions

View file

@ -111,11 +111,11 @@ int WinThreadLaunch(void *arg, // rdi
// 2. windows owns the stack memory right now
// we need win32 raw imports because:
// 1. generated thunks are function logged
noasan noinstrument static textwindows wontreturn void //
WinThreadEntry(int rdi, // rcx
int rsi, // rdx
int rdx, // r8
struct CloneArgs *wt) { // r9
noasan dontinstrument static textwindows wontreturn void //
WinThreadEntry(int rdi, // rcx
int rsi, // rdx
int rdx, // r8
struct CloneArgs *wt) { // r9
int rc;
if (wt->tls) __set_tls_win32(wt->tls);
*wt->ctid = wt->tid;

View file

@ -37,9 +37,8 @@ forceinline char *MemChr(const char *s, unsigned char c, unsigned long n) {
return 0;
}
static textwindows noasan noinstrument axdx_t Recode16to8(char *dst,
size_t dstsize,
const char16_t *src) {
static textwindows noasan dontinstrument axdx_t
Recode16to8(char *dst, size_t dstsize, const char16_t *src) {
bool v;
axdx_t r;
uint64_t w;
@ -72,7 +71,7 @@ static textwindows noasan noinstrument axdx_t Recode16to8(char *dst,
return r;
}
textwindows noinstrument noasan void FixPath(char *path) {
textwindows dontinstrument noasan void FixPath(char *path) {
char *p;
size_t i;
@ -112,9 +111,9 @@ textwindows noinstrument noasan void FixPath(char *path) {
// @param envp stores NULL-terminated string pointer list (optional)
// @param max is the pointer count capacity of envp
// @return number of variables decoded, excluding NULL-terminator
textwindows noasan noinstrument int GetDosEnviron(const char16_t *env,
char *buf, size_t size,
char **envp, size_t max) {
textwindows noasan dontinstrument int GetDosEnviron(const char16_t *env,
char *buf, size_t size,
char **envp, size_t max) {
int i;
char *p;
axdx_t r;

View file

@ -27,7 +27,7 @@ extern _Hide struct SymbolTable *__symtab;
* @param t if null will be auto-populated only if already open
* @return index or -1 if nothing found
*/
noinstrument privileged int __get_symbol(struct SymbolTable *t, intptr_t a) {
dontinstrument privileged int __get_symbol(struct SymbolTable *t, intptr_t a) {
// we need privileged because:
// kprintf is privileged and it depends on this
// we don't want function tracing because:

View file

@ -18,7 +18,7 @@
*/
#include "libc/runtime/symbols.internal.h"
privileged noinstrument noasan noubsan char *__get_symbol_name(
privileged dontinstrument noasan noubsan char *__get_symbol_name(
struct SymbolTable *t, int s) {
/* asan runtime depends on this function */
if (t && s != -1) {

View file

@ -106,7 +106,8 @@ static privileged void HookFunction(code_t *func, void *dest) {
* @param st can be obtained using `GetSymbolTable()`
* @see ape/ape.lds
*/
privileged noinstrument noasan int __hook(void *dest, struct SymbolTable *st) {
privileged dontinstrument noasan int __hook(void *dest,
struct SymbolTable *st) {
long i;
sigset_t mask;
code_t *p, *pe;

View file

@ -18,7 +18,7 @@
*/
#include "libc/intrin/kprintf.h"
privileged noasan noinstrument void __stack_chk_fail(void) {
void __stack_chk_fail(void) {
kprintf("stack smashed\n");
__builtin_trap();
}