Make improvements

- Introduce portable sched_getcpu() api
- Support GCC's __target_clones__ feature
- Make fma() go faster on x86 in default mode
- Remove some asan checks from core libraries
- WinMain() now ensures $HOME and $USER are defined
This commit is contained in:
Justine Tunney 2024-02-01 03:39:46 -08:00
parent d5225a693b
commit 2ab9e9f7fd
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
192 changed files with 2809 additions and 932 deletions

View file

@ -36,7 +36,7 @@ static struct {
char buf[PATH_MAX];
} g_addr2line;
const void GetAddr2linePathInit(void) {
void GetAddr2linePathInit(void) {
int e = errno;
const char *path;
if (!(path = getenv("ADDR2LINE"))) {

View file

@ -48,10 +48,10 @@ void __cxa_printexits(FILE *f, void *pred) {
if (symbol) {
snprintf(name, sizeof(name), "%s", symbol);
} else {
snprintf(name, sizeof(name), "0x%016lx", b->p[i].fp);
snprintf(name, sizeof(name), "0x%016lx", (unsigned long)b->p[i].fp);
}
fprintf(f, "%-22s 0x%016lx 0x%016lx\n", name, b->p[i].arg,
b->p[i].pred);
fprintf(f, "%-22s 0x%016lx 0x%016lx\n", name,
(unsigned long)b->p[i].arg, (unsigned long)b->p[i].pred);
}
}
} while ((b = b->next));

View file

@ -20,6 +20,7 @@
#include "libc/errno.h"
#include "libc/intrin/describebacktrace.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/runtime/symbols.internal.h"
@ -51,5 +52,6 @@ relegated wontreturn void __die(void) {
__nocolor ? "" : "\e[1;31m", program_invocation_short_name, host,
getpid(), gettid(), __nocolor ? "" : "\e[0m", FindDebugBinary(),
DescribeBacktrace(__builtin_frame_address(0)));
ShowBacktrace(2, __builtin_frame_address(0));
_Exit(77);
}

View file

@ -41,7 +41,7 @@ relegated int(gdbexec)(const char *cmd) {
elf = "-q";
}
bp = __builtin_frame_address(0);
sprintf(breakcmd, "%s *%#p", "break", bp->addr);
sprintf(breakcmd, "%s *%#lx", "break", (unsigned long)bp->addr);
if (!(pid = vfork())) {
execv(gdb, (char *const[]){
"gdb",

View file

@ -252,16 +252,9 @@ static relegated void ShowCrashReport(int err, int sig, struct siginfo *si,
}
relegated void __oncrash(int sig, struct siginfo *si, void *arg) {
ucontext_t *ctx = arg;
int gdbpid, err;
err = errno;
if ((gdbpid = IsDebuggerPresent(true))) {
DebugBreak();
}
if (!(gdbpid > 0 && (sig == SIGTRAP || sig == SIGQUIT))) {
__restore_tty();
ShowCrashReport(err, sig, si, ctx);
}
int err = errno;
__restore_tty();
ShowCrashReport(err, sig, si, arg);
}
#endif /* __x86_64__ */