Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -10,7 +10,6 @@ o/$(MODE)/test/libc: \
o/$(MODE)/test/libc/mem \
o/$(MODE)/test/libc/nexgen32e \
o/$(MODE)/test/libc/proc \
o/$(MODE)/test/libc/release \
o/$(MODE)/test/libc/runtime \
o/$(MODE)/test/libc/sock \
o/$(MODE)/test/libc/stdio \

View file

@ -1,246 +0,0 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
ifneq ($(MODE), dbg)
ifneq ($(MODE), asan)
ifeq ($(ARCH), x86_64)
o/$(MODE)/test/libc/release/cosmopolitan.zip: private .UNSANDBOXED = 1
o/$(MODE)/test/libc/release/cosmopolitan.zip: \
o/cosmopolitan.h \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/ape/ape-copy-self.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/zip/zip
@$(COMPILE) -AZIP -T$@ \
o/$(MODE)/third_party/zip/zip \
-b$(TMPDIR) -qj $@ \
o/cosmopolitan.h \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/ape/ape-copy-self.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a
o/$(MODE)/test/libc/release/smoke.o: \
test/libc/release/smoke.c \
o/cosmopolitan.h
@$(COMPILE) -ACC $(CC) \
-o $@ \
-c \
-Os \
-Werror \
-fno-pie \
-nostdinc \
-D_COSMO_SOURCE \
-Wl,--gc-sections \
-z noexecstack \
-fno-omit-frame-pointer \
-include o/cosmopolitan.h \
-Wl,-z,max-page-size=0x1000 \
-Wl,-z,common-page-size=0x1000 \
-Wl,-z,noexecstack \
$<
o/$(MODE)/test/libc/release/smoke.dbg: \
o/$(MODE)/test/libc/release/smoke.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/cosmopolitan.a
@$(COMPILE) -ALD $(LD) \
-static \
-no-pie \
-nostdlib \
--gc-sections \
-z noexecstack \
-z max-page-size=0x1000 \
-z common-page-size=0x1000 \
-T o/$(MODE)/ape/ape.lds \
o/$(MODE)/test/libc/release/smoke.o \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smoke-nms.dbg: \
o/$(MODE)/test/libc/release/smoke.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a
@$(COMPILE) -ALD $(LD) \
-static \
-no-pie \
-nostdlib \
--gc-sections \
-z noexecstack \
-z max-page-size=0x1000 \
-z common-page-size=0x1000 \
-T o/$(MODE)/ape/ape.lds \
o/$(MODE)/test/libc/release/smoke.o \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smoke-chibicc.dbg: \
o/$(MODE)/test/libc/release/smoke-chibicc.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/chibicc/chibicc
@$(COMPILE) -ALD $(LD) \
-static \
-no-pie \
-nostdlib \
--gc-sections \
-z noexecstack \
-z max-page-size=0x1000 \
-z common-page-size=0x1000 \
-T o/$(MODE)/ape/ape.lds \
o/$(MODE)/test/libc/release/smoke-chibicc.o \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smoke-chibicc.o: \
test/libc/release/smoke.c \
o/cosmopolitan.h \
o/$(MODE)/third_party/chibicc/chibicc
@$(COMPILE) -wACHIBICC \
o/$(MODE)/third_party/chibicc/chibicc \
$(CHIBICC_FLAGS) \
-o $@ \
-c \
-Os \
-static \
-Werror \
-fno-pie \
-nostdlib \
-nostdinc \
-mno-red-zone \
-D_COSMO_SOURCE \
-fno-omit-frame-pointer \
-include o/cosmopolitan.h \
$<
o/$(MODE)/test/libc/release/smokecxx.dbg: \
o/$(MODE)/test/libc/release/smokecxx.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/libcxx/libcxx.a
@$(COMPILE) -ALD $(LD) \
-static \
-no-pie \
-nostdlib \
--gc-sections \
-z noexecstack \
-z max-page-size=0x1000 \
-z common-page-size=0x1000 \
-T o/$(MODE)/ape/ape.lds \
o/$(MODE)/test/libc/release/smokecxx.o \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/third_party/libcxx/libcxx.a \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smokecxx.o: \
test/libc/release/smokecxx.cc \
o/cosmopolitan.h
@$(COMPILE) -ACXX $(CXX) \
-o $@ \
-c \
-Os \
-fno-pie \
-nostdinc \
-Wl,--gc-sections \
-Wl,-z,noexecstack \
-fno-omit-frame-pointer \
-z max-page-size=0x1000 \
-z common-page-size=0x1000 \
-include o/cosmopolitan.h \
test/libc/release/smokecxx.cc
o/$(MODE)/test/libc/release/smokeansi.dbg: \
o/$(MODE)/test/libc/release/smokeansi.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/cosmopolitan.a
@$(COMPILE) -ALD $(LD) \
-static \
-no-pie \
-nostdlib \
--gc-sections \
-z noexecstack \
-z max-page-size=0x1000 \
-z common-page-size=0x1000 \
-T o/$(MODE)/ape/ape.lds \
o/$(MODE)/test/libc/release/smokeansi.o \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape.o \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smokeansi.o: \
test/libc/release/smoke.c \
o/cosmopolitan.h
@$(COMPILE) -AANSI $(CC) \
-o $@ \
-c \
-Os \
-ansi \
-Werror \
-static \
-fno-pie \
-nostdinc \
-D_COSMO_SOURCE \
-Wl,--gc-sections \
-Wl,-z,noexecstack \
-fno-omit-frame-pointer \
-include o/cosmopolitan.h \
-Wl,-z,max-page-size=0x1000 \
-Wl,-z,common-page-size=0x1000 \
test/libc/release/smoke.c
# TODO(jart): Rewrite these shell scripts as C code.
# o/$(MODE)/test/libc/release/metal.ok: \
# test/libc/release/metal.sh \
# o/$(MODE)/examples/hello \
# o/$(MODE)/tool/build/blinkenlights.dbg
# @$(COMPILE) -ASHTEST -tT$@ $<
# o/$(MODE)/test/libc/release/emulate.ok: \
# test/libc/release/emulate.sh \
# o/$(MODE)/examples/hello \
# o/$(MODE)/tool/build/blinkenlights.dbg
# @$(COMPILE) -ASHTEST -tT$@ $<
.PHONY: o/$(MODE)/test/libc/release
o/$(MODE)/test/libc/release: \
o/$(MODE)/test/libc/release/smoke \
o/$(MODE)/test/libc/release/smoke.runs \
o/$(MODE)/test/libc/release/smoke-nms \
o/$(MODE)/test/libc/release/smoke-nms.runs \
o/$(MODE)/test/libc/release/smoke-chibicc \
o/$(MODE)/test/libc/release/smoke-chibicc.runs \
o/$(MODE)/test/libc/release/smokecxx \
o/$(MODE)/test/libc/release/smokecxx.runs \
o/$(MODE)/test/libc/release/smokeansi \
o/$(MODE)/test/libc/release/smokeansi.runs
endif
endif
endif
.PHONY: o/$(MODE)/test/libc/release
o/$(MODE)/test/libc/release:

View file

@ -1,24 +0,0 @@
#!/bin/sh
if [ "$MODE" = dbg ]; then
exit # TODO
fi
if [ "$MODE" = opt ] || [ "$MODE" = optlinux ]; then
exit
fi
# smoke test userspace binary emulation
CMD="o/$MODE/tool/build/blinkenlights.dbg o/$MODE/examples/hello"
if OUTPUT="$($CMD)"; then
if [ x"$OUTPUT" = x"hello world" ]; then
exit 0
else
printf '%s\n' "error: $CMD printed wrong output: $OUTPUT" >&2
exit 1
fi
else
RC=$?
printf '%s\n' "error: $CMD failed: $RC" >&2
exit $RC
fi

View file

@ -1,28 +0,0 @@
#!/bin/sh
# TODO(jart): Stack size increase probably broke this.
exit
if [ "$MODE" = dbg ]; then
exit # TODO
fi
if [ "$MODE" = opt ] || [ "$MODE" = optlinux ]; then
exit
fi
$MKDIR o/$MODE/test/libc/release/
# smoke test booting on bare metal and printing data to serial uart
CMD="o/$MODE/tool/build/blinkenlights.dbg -r o/$MODE/examples/hello"
if OUTPUT="$($CMD)"; then
if [ x"$OUTPUT" = x"hello world" ]; then
exit 0
else
printf '%s\n' "error: $CMD printed wrong output: $OUTPUT" >&2
exit 1
fi
else
RC=$?
printf '%s\n' "error: $CMD failed: $RC" >&2
exit $RC
fi

View file

@ -1,13 +0,0 @@
int main(int argc, char *argv[]) {
int rc;
char *s;
FILE *f;
ShowCrashReports();
s = strdup(argv[0]);
s[0] = 'Z';
f = fopen("/dev/null", "w");
fputs(gc(xasprintf("hello world %d %s\n", argc, s)), f);
fclose(f);
free(s);
return 0;
}

View file

@ -1,7 +0,0 @@
int main() {
int *x = new int[32];
x[0] = 2;
x[1] = 2;
x[2] = x[0] + x[1];
return x[2] - 4;
}