Release Cosmopolitan v3.6.0

This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
Justine Tunney 2024-07-23 03:16:17 -07:00
parent 62ace3623a
commit 5660ec4741
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1585 changed files with 117353 additions and 271644 deletions

View file

@ -80,23 +80,19 @@ void SetUp(void) {
sigaction(SIGSEGV, &sa, 0);
}
int StackOverflow(int f(), int n) {
if (n < INT_MAX) {
return f(f, n + 1) - 1;
} else {
return INT_MAX;
}
int StackOverflow(void);
int (*pStackOverflow)(void) = StackOverflow;
int StackOverflow(void) {
return pStackOverflow();
}
int (*pStackOverflow)(int (*)(), int) = StackOverflow;
TEST(stackoverflow, standardStack_altStack_process_longjmp) {
if (IsTiny())
return; // TODO(jart): why?
int jumpcode;
if (!(jumpcode = setjmp(recover))) {
exit(pStackOverflow(pStackOverflow, 0));
exit(pStackOverflow());
}
ASSERT_EQ(123, jumpcode);
ASSERT_TRUE(smashed_stack);

View file

@ -51,16 +51,12 @@ void CrashHandler(int sig, siginfo_t *si, void *ctx) {
longjmp(recover, 123);
}
int StackOverflow(int f(), int n) {
if (n < INT_MAX) {
return f(f, n + 1) - 1;
} else {
return INT_MAX;
}
int StackOverflow(void);
int (*pStackOverflow)(void) = StackOverflow;
int StackOverflow(void) {
return pStackOverflow();
}
int (*pStackOverflow)(int (*)(), int) = StackOverflow;
void *MyPosixThread(void *arg) {
int jumpcode;
struct sigaction sa, o1, o2;
@ -75,7 +71,7 @@ void *MyPosixThread(void *arg) {
sigaction(SIGBUS, &sa, &o1);
sigaction(SIGSEGV, &sa, &o2);
if (!(jumpcode = setjmp(recover))) {
exit(pStackOverflow(pStackOverflow, 0));
exit(pStackOverflow());
}
ASSERT_EQ(123, jumpcode);
sigaction(SIGSEGV, &o2, 0);

View file

@ -85,16 +85,12 @@ void CrashHandler(int sig, siginfo_t *si, void *arg) {
#endif
}
int StackOverflow(int f(), int n) {
if (n < INT_MAX) {
return f(f, n + 1) - 1;
} else {
return INT_MAX;
}
int StackOverflow(void);
int (*pStackOverflow)(void) = StackOverflow;
int StackOverflow(void) {
return pStackOverflow();
}
int (*pStackOverflow)(int (*)(), int) = StackOverflow;
void *MyPosixThread(void *arg) {
struct sigaction sa;
struct sigaltstack ss;
@ -107,7 +103,7 @@ void *MyPosixThread(void *arg) {
sa.sa_sigaction = CrashHandler;
sigaction(SIGBUS, &sa, 0);
sigaction(SIGSEGV, &sa, 0);
exit(pStackOverflow(pStackOverflow, 0));
exit(pStackOverflow());
return 0;
}

View file

@ -45,16 +45,12 @@ void CrashHandler(int sig) {
pthread_exit((void *)123L);
}
int StackOverflow(int f(), int n) {
if (n < INT_MAX) {
return f(f, n + 1) - 1;
} else {
return INT_MAX;
}
int StackOverflow(void);
int (*pStackOverflow)(void) = StackOverflow;
int StackOverflow(void) {
return pStackOverflow();
}
int (*pStackOverflow)(int (*)(), int) = StackOverflow;
void *MyPosixThread(void *arg) {
struct sigaction sa;
struct sigaltstack ss;
@ -67,7 +63,7 @@ void *MyPosixThread(void *arg) {
sa.sa_handler = CrashHandler;
sigaction(SIGBUS, &sa, 0);
sigaction(SIGSEGV, &sa, 0);
exit(pStackOverflow(pStackOverflow, 0));
exit(pStackOverflow());
return 0;
}

View file

@ -34,18 +34,14 @@ void CrashHandler(int sig) {
pthread_exit(0);
}
int StackOverflow(int f(), int n) {
if (n < INT_MAX) {
return f(f, n + 1) - 1;
} else {
return INT_MAX;
}
int StackOverflow(void);
int (*pStackOverflow)(void) = StackOverflow;
int StackOverflow(void) {
return pStackOverflow();
}
int (*pStackOverflow)(int (*)(), int) = StackOverflow;
void *MyPosixThread(void *arg) {
exit(pStackOverflow(pStackOverflow, 0));
exit(pStackOverflow());
return 0;
}

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/math.h"
#include "libc/testlib/testlib.h"
#include "third_party/libcxx/math.h"
TEST(fmax, test) {
EXPECT_TRUE(fmax(2., 3.) == 3.);

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/fmt/conv.h"
#include "libc/intrin/weaken.h"
#include "libc/limits.h"
#include "libc/log/log.h"
#include "libc/mem/leaks.h"
@ -27,12 +28,8 @@
#include "libc/str/str.h"
#ifdef __x86_64__
int StackOverflow(int f(), int n) {
if (n < INT_MAX) {
return f(f, n + 1) - 1;
} else {
return INT_MAX;
}
int StackOverflow(void) {
return _weaken(StackOverflow)();
}
void FpuCrash(void) {
@ -95,7 +92,7 @@ int (*pRodataOverrunCrash)(int) = RodataOverrunCrash;
char *(*pStackOverrunCrash)(int) = StackOverrunCrash;
char *(*pMemoryLeakCrash)(void) = MemoryLeakCrash;
int (*pNpeCrash)(char *) = NpeCrash;
int (*pStackOverflow)(int (*)(), int) = StackOverflow;
int (*pStackOverflow)(void) = StackOverflow;
int main(int argc, char *argv[]) {
ShowCrashReports();
@ -123,7 +120,7 @@ int main(int argc, char *argv[]) {
case 8:
exit(pNpeCrash(0));
case 9:
exit(pStackOverflow(pStackOverflow, 0));
exit(pStackOverflow());
default:
fputs("error: unrecognized argument\n", stderr);
exit(1);

View file

@ -21,6 +21,7 @@
#include "libc/dce.h"
#include "libc/intrin/kprintf.h"
#include "libc/limits.h"
#include "libc/math.h"
#include "libc/mem/gc.h"
#include "libc/nt/createfile.h"
#include "libc/nt/enum/accessmask.h"
@ -36,7 +37,6 @@
#include "libc/testlib/testlib.h"
#include "libc/thread/thread.h"
#include "libc/x/x.h"
#include "third_party/libcxx/math.h"
bool gotsome;
ucontext_t uc, goback;

View file

@ -1,59 +0,0 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2024 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/cpuset.h"
#include "libc/dce.h"
#include "libc/runtime/runtime.h"
#include "libc/testlib/testlib.h"
#include "libc/thread/thread.h"
#include "libc/thread/thread2.h"
TEST(pthread_setaffinity_np, test) {
// works on almost nothing
if (IsXnu())
return;
if (IsNetbsd())
return;
if (IsOpenbsd())
return;
if (__get_cpu_count() < 2)
return;
// save bitset
cpu_set_t old;
if (!IsWindows())
ASSERT_EQ(0, pthread_getaffinity_np(pthread_self(), sizeof(old), &old));
// go to first cpu
cpu_set_t bitset;
CPU_ZERO(&bitset);
CPU_SET(0, &bitset);
ASSERT_EQ(0, pthread_setaffinity_np(pthread_self(), sizeof(bitset), &bitset));
ASSERT_EQ(0, sched_getcpu());
// go to second cpu
CPU_ZERO(&bitset);
CPU_SET(1, &bitset);
ASSERT_EQ(0, pthread_setaffinity_np(pthread_self(), sizeof(bitset), &bitset));
ASSERT_EQ(1, sched_getcpu());
// restore bitset
if (!IsWindows())
ASSERT_EQ(0, pthread_setaffinity_np(pthread_self(), sizeof(old), &old));
}