Fix breakages in Linux-only build modes

- compile.com now polyfills -march=native which gcc/clang removed
- Guarantee zero Windows code is linked into non-Windows binaries
- MODE=tinylinux binaries are now back to being as tiny as ~4kb
- Improve the runtime's stack allocation / alignment hack
- GitHub Actions now tests Linux modes for assurance
This commit is contained in:
Justine Tunney 2023-07-09 19:47:46 -07:00
parent 0e4c828a8e
commit 3dc86ce154
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
32 changed files with 283 additions and 104 deletions

View file

@ -18,8 +18,10 @@
*/
#include "libc/calls/internal.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/mem/gc.internal.h"
#include "libc/testlib/testlib.h"
#if SupportsWindows()
char16_t p[PATH_MAX];
@ -48,3 +50,5 @@ TEST(mkntpath, testRemoveDoubleSlash) {
EXPECT_EQ(21, __mkntpath("C:\\Users\\jart\\\\.config", p));
EXPECT_STREQ(u"C:\\Users\\jart\\.config", p);
}
#endif /* SupportsWindows() */

View file

@ -100,13 +100,14 @@ TEST(pthread_setname_np, GetNameOfOtherThread) {
ASSERT_EQ(0, pthread_create(&id, 0, GetNameOfOtherThreadWorker, 0));
while (!atomic_load(&sync1)) pthread_yield();
errno_t e = pthread_getname_np(id, me, sizeof(me));
if (IsLinux() && e == ENOENT) return; // bah old kernel
if (IsLinux() && e == EACCES) return; // meh landlock
if (IsLinux() && e == ENOENT) goto GiveUp; // bah old kernel
if (IsLinux() && e == EACCES) goto GiveUp; // meh landlock
ASSERT_EQ(0, e);
EXPECT_STREQ("justine", me);
ASSERT_EQ(0, pthread_setname_np(id, "tunney"));
ASSERT_EQ(0, pthread_getname_np(id, me, sizeof(me)));
EXPECT_STREQ("tunney", me);
GiveUp:
atomic_store(&sync2, 1);
ASSERT_EQ(0, pthread_join(id, 0));
}