mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 11:48:30 +00:00
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:
parent
d5225a693b
commit
2ab9e9f7fd
192 changed files with 2809 additions and 932 deletions
|
@ -43,7 +43,6 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/divmod10.internal.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/intrin/bsr.h"
|
||||
#include "libc/intrin/nomultics.internal.h"
|
||||
#include "libc/intrin/safemacros.internal.h"
|
||||
|
@ -53,6 +52,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/mem/reverse.internal.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/serialize.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/str/strwidth.h"
|
||||
#include "libc/str/tab.internal.h"
|
||||
|
@ -800,7 +800,7 @@ int __fmt(void *fn, void *arg, const char *format, va_list va) {
|
|||
|
||||
x = 0;
|
||||
lasterr = errno;
|
||||
out = fn ? fn : __fmt_noop;
|
||||
out = fn ? fn : (void *)__fmt_noop;
|
||||
|
||||
while (*format) {
|
||||
if (*format != '%') {
|
||||
|
|
|
@ -50,5 +50,5 @@ int ftw(const char *dirpath,
|
|||
/* The following cast assumes that calling a function with one
|
||||
* argument more than it needs behaves as expected. This is
|
||||
* actually undefined, but works on all real-world machines. */
|
||||
return nftw(dirpath, (int (*)())fn, fd_limit, FTW_PHYS);
|
||||
return nftw(dirpath, (void *)fn, fd_limit, FTW_PHYS);
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ static const char *FindNameById(const struct IdName *names, unsigned long id) {
|
|||
}
|
||||
|
||||
static void PrintDependencies(const char *prologue) {
|
||||
#ifdef __x86_64__
|
||||
struct NtLinkedList *head = &NtGetPeb()->Ldr->InLoadOrderModuleList;
|
||||
struct NtLinkedList *ldr = head->Next;
|
||||
do {
|
||||
|
@ -92,6 +93,7 @@ static void PrintDependencies(const char *prologue) {
|
|||
PRINT(" ☼ %.*!hs (%'zukb @ %p)", dll->FullDllName.Length,
|
||||
dll->FullDllName.Data, dll->SizeOfImage / 1024, dll->DllBase);
|
||||
} while ((ldr = ldr->Next) && ldr != head);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Print(const char *prologue) {
|
||||
|
@ -624,6 +626,7 @@ textstartup void __printargs(const char *prologue) {
|
|||
if (GetConsoleMode(GetStdHandle(kNtStdErrorHandle), &cm))
|
||||
PRINT(" %s", DescribeNtConsoleOutFlags(cm));
|
||||
|
||||
#ifdef __x86_64__
|
||||
PRINT("");
|
||||
PRINT("TEB");
|
||||
PRINT(" ☼ gs:0x%02x %s = %p", 0x00, "NtGetSeh()", _NtGetSeh());
|
||||
|
@ -640,6 +643,7 @@ textstartup void __printargs(const char *prologue) {
|
|||
PRINT(" ☼ gs:0x%02x %s = %p", 0x58, "NtGetTls()", _NtGetTls());
|
||||
PRINT(" ☼ gs:0x%02x %s = %p", 0x60, "NtGetPeb()", NtGetPeb());
|
||||
PRINT(" ☼ gs:0x%02x %s = %p", 0x68, "NtGetErr()", NtGetErr());
|
||||
#endif
|
||||
|
||||
PRINT("");
|
||||
PRINT("DEPENDENCIES");
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
* If RDSEED isn't available, we'll try RDRAND (which we automatically
|
||||
* disable for microarchitectures where it's known to be slow or buggy).
|
||||
* If RDRAND isn't available then we try getrandom(), RtlGenRandom(), or
|
||||
* If RDRAND isn't available then we try getrandom(), ProcessPrng(), or
|
||||
* sysctl(KERN_ARND). If those aren't available then we try /dev/urandom
|
||||
* and if that fails, we use RDTSC and getpid().
|
||||
*
|
||||
|
|
|
@ -45,9 +45,6 @@ dontasan void *rngset(void *b, size_t n, uint64_t seed(void), size_t reseed) {
|
|||
size_t m;
|
||||
uint64_t x, t = 0;
|
||||
unsigned char *p = b;
|
||||
if (IsAsan()) {
|
||||
__asan_verify(b, n);
|
||||
}
|
||||
if (!seed) {
|
||||
t = reseed;
|
||||
reseed = -1;
|
||||
|
|
|
@ -90,7 +90,7 @@ int fsetpos(FILE *, const fpos_t *) libcesque paramsnonnull();
|
|||
FILE *tmpfile(void) libcesque __wur;
|
||||
char *tmpnam(char *) libcesque __wur;
|
||||
char *tmpnam_r(char *) libcesque __wur;
|
||||
int system(const char *) libcesque;
|
||||
|
||||
FILE *popen(const char *, const char *) libcesque;
|
||||
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -35,7 +34,6 @@ static char g_tmpnam[L_tmpnam];
|
|||
* is only mutated on success
|
||||
*/
|
||||
char *tmpnam(char *buf) {
|
||||
if (IsAsan()) __asan_verify(buf, L_tmpnam);
|
||||
char path[] = P_tmpdir "/tmpnam_XXXXXX";
|
||||
for (int t = 0; t < 100; ++t) {
|
||||
int w = _rand64();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue