Freshen build/bootstrap/cocmd

See https://news.ycombinator.com/item?id=41055121
This commit is contained in:
Justine Tunney 2024-07-27 23:22:11 -07:00
parent 8621034d42
commit e18fe1e112
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
11 changed files with 15 additions and 18 deletions

View file

@ -115,10 +115,8 @@ ZIPCOPY = $(BOOTSTRAP)/zipcopy
PECHECK = $(BOOTSTRAP)/pecheck PECHECK = $(BOOTSTRAP)/pecheck
FIXUPOBJ = $(BOOTSTRAP)/fixupobj FIXUPOBJ = $(BOOTSTRAP)/fixupobj
OBJBINCOPY = $(BOOTSTRAP)/objbincopy OBJBINCOPY = $(BOOTSTRAP)/objbincopy
MKDIR = build/bootstrap/mkdir -p MKDIR = $(BOOTSTRAP)/mkdir.ape -p
COMPILE = build/bootstrap/compile -V9 -M2048m -P8192 $(QUOTA) COMPILE = $(BOOTSTRAP)/compile.ape -V9 -M2048m -P8192 $(QUOTA)
IGNORE := $(shell $(MKDIR) $(TMPDIR))
# the default build modes is empty string # the default build modes is empty string
# on x86_64 hosts, MODE= is the same as MODE=x86_64 # on x86_64 hosts, MODE= is the same as MODE=x86_64
@ -141,7 +139,6 @@ HOSTS ?= freebsd rhel7 xnu openbsd netbsd win10
endif endif
ZIPOBJ_FLAGS += -a$(ARCH) ZIPOBJ_FLAGS += -a$(ARCH)
IGNORE := $(shell $(MKDIR) $(TMPDIR))
export ADDR2LINE export ADDR2LINE
export LC_ALL export LC_ALL
@ -150,10 +147,12 @@ export MODE
export SOURCE_DATE_EPOCH export SOURCE_DATE_EPOCH
export TMPDIR export TMPDIR
COSMOCC = .cosmocc/3.6.0 COSMOCC = .cosmocc/3.6.2
BOOTSTRAP = $(COSMOCC)/bin BOOTSTRAP = $(COSMOCC)/bin
TOOLCHAIN = $(COSMOCC)/bin/$(ARCH)-linux-cosmo- TOOLCHAIN = $(COSMOCC)/bin/$(ARCH)-linux-cosmo-
DOWNLOAD := $(shell build/download-cosmocc.sh $(COSMOCC) 3.6.0 4918c45ac3e0972ff260e2a249e25716881e39fb679d5e714ae216a2ef6c3f7e) DOWNLOAD := $(shell build/download-cosmocc.sh $(COSMOCC) 3.6.2 268aa82d9bfd774f76951b250f87b8edcefd5c754b8b409e1639641e8bd8d5bc)
IGNORE := $(shell $(MKDIR) $(TMPDIR))
AS = $(TOOLCHAIN)as AS = $(TOOLCHAIN)as
CC = $(TOOLCHAIN)gcc CC = $(TOOLCHAIN)gcc

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/assert.h"
#include "libc/calls/createfileflags.internal.h" #include "libc/calls/createfileflags.internal.h"
#include "libc/calls/internal.h" #include "libc/calls/internal.h"
#include "libc/calls/sig.internal.h" #include "libc/calls/sig.internal.h"
@ -155,11 +156,11 @@ static textwindows void FreeKeystrokeImpl(struct Dll *key) {
static textwindows struct Keystroke *NewKeystroke(void) { static textwindows struct Keystroke *NewKeystroke(void) {
struct Dll *e = dll_first(__keystroke.free); struct Dll *e = dll_first(__keystroke.free);
if (!e) // See MIN(freekeys) before ReadConsoleInput()
__builtin_trap();
struct Keystroke *k = KEYSTROKE_CONTAINER(e); struct Keystroke *k = KEYSTROKE_CONTAINER(e);
dll_remove(&__keystroke.free, &k->elem); dll_remove(&__keystroke.free, &k->elem);
--__keystroke.freekeys; --__keystroke.freekeys;
// TODO(jart): What's wrong with GCC 12.3?
asm("" : "+r"(k));
k->buflen = 0; k->buflen = 0;
return k; return k;
} }
@ -560,19 +561,16 @@ static textwindows void IngestConsoleInput(void) {
return; return;
if (__keystroke.end_of_file) if (__keystroke.end_of_file)
return; return;
if (!GetNumberOfConsoleInputEvents(__keystroke.cin, &n)) { if (!GetNumberOfConsoleInputEvents(__keystroke.cin, &n))
goto UnexpectedEof; goto UnexpectedEof;
}
if (!n) if (!n)
return; return;
n = MIN(__keystroke.freekeys, MIN(ARRAYLEN(records), n)); n = MIN(__keystroke.freekeys, MIN(ARRAYLEN(records), n));
if (!ReadConsoleInput(__keystroke.cin, records, n, &n)) { if (!ReadConsoleInput(__keystroke.cin, records, n, &n))
goto UnexpectedEof; goto UnexpectedEof;
} for (i = 0; i < n && !__keystroke.end_of_file; ++i)
for (i = 0; i < n && !__keystroke.end_of_file; ++i) {
IngestConsoleInputRecord(records + i); IngestConsoleInputRecord(records + i);
} }
}
UnexpectedEof: UnexpectedEof:
STRACE("console read error %d", GetLastError()); STRACE("console read error %d", GetLastError());
__keystroke.end_of_file = true; __keystroke.end_of_file = true;

View file

@ -38,7 +38,7 @@ size_t wcsnrtombs(char *dst, const wchar_t **wcs, size_t wn, size_t n,
if (!dst) if (!dst)
n = 0; n = 0;
while (ws && wn) { while (ws && wn) {
char tmp[MB_LEN_MAX]; char tmp[MB_LEN_MAX] = {0};
size_t l = wcrtomb(n < MB_LEN_MAX ? tmp : dst, *ws, 0); size_t l = wcrtomb(n < MB_LEN_MAX ? tmp : dst, *ws, 0);
if (l == -1) { if (l == -1) {
cnt = -1; cnt = -1;

View file

@ -128,8 +128,8 @@ wontreturn void pthread_exit(void *rc) {
// implementation called exit() with a zero argument at thread // implementation called exit() with a zero argument at thread
// termination time." ──Quoth POSIX.1-2017 // termination time." ──Quoth POSIX.1-2017
if (orphan) { if (orphan) {
for (const uintptr_t *p = __fini_array_end; p > __fini_array_start;) for (int i = __fini_array_end - __fini_array_start; i--;)
((void (*)(void))(*--p))(); ((void (*)(void))__fini_array_start[i])();
_Exit(0); _Exit(0);
} }