Get codebase completely working with LLVM

You can now build Cosmopolitan with Clang:

    make -j8 MODE=llvm
    o/llvm/examples/hello.com

The assembler and linker code is now friendly to LLVM too.
So it's not needed to configure Clang to use binutils under
the hood. If you love LLVM then you can now use pure LLVM.
This commit is contained in:
Justine Tunney 2021-02-08 09:19:00 -08:00
parent 0e36cb3ac4
commit e75ffde09e
4528 changed files with 7776 additions and 11640 deletions

View file

@ -20,9 +20,9 @@
.yoink testlib_runallbenchmarks
.source __FILE__
/ Decentralized section for benchmark registration.
/
/ @see ape/ape.lds
// Decentralized section for benchmark registration.
//
// @see ape/ape.lds
.section .piro.relo.sort.bench.1,"aw",@nobits
.type __bench_start,@object
.type __bench_end,@object

View file

@ -19,9 +19,9 @@
#include "libc/macros.h"
.source __FILE__
/ Decentralized section for test combo registration.
/
/ @see ape/ape.lds
// Decentralized section for test combo registration.
//
// @see ape/ape.lds
.section .piro.relo.sort.combo.1,"aw",@nobits
.type __combo_start,@object
.type __combo_end,@object

View file

@ -19,9 +19,9 @@
#include "libc/macros.h"
.source __FILE__
/ Decentralized section for test fixture registration.
/
/ @see ape/ape.lds
// Decentralized section for test fixture registration.
//
// @see ape/ape.lds
.section .piro.relo.sort.fixture.1,"aw",@nobits
.type __fixture_start,@object
.type __fixture_end,@object

View file

@ -39,9 +39,7 @@ testonly void testlib_runfixtures(testfn_t *test_start, testfn_t *test_end,
for (i = 0; i < count && !g_testlib_failed; ++i) {
(snprintf)(g_fixturename, sizeof(g_fixturename), "%s_%s",
fixture_start[i].group, fixture_start[i].name);
_piro(PROT_READ | PROT_WRITE);
fixture_start[i].fn();
_piro(PROT_READ);
testlib_runtestcases(test_start, test_end, NULL);
}
}

View file

@ -20,7 +20,7 @@
.source __FILE__
.rodata
/ Nontrivial NUL-terminated string test vector.
// Nontrivial NUL-terminated string test vector.
.align 1
kHyperion:
0: .incbin "libc/testlib/hyperion.txt"

View file

@ -19,9 +19,9 @@
#include "libc/macros.h"
.source __FILE__
/ Decentralized section for test testcase registration.
/
/ @see ape/ape.lds
// Decentralized section for test testcase registration.
//
// @see ape/ape.lds
.section .piro.relo.sort.testcase.1,"aw",@nobits
.type __testcase_start,@object
.type __testcase_end,@object

View file

@ -20,19 +20,19 @@
.source __FILE__
.testonly
/ Empties L1 instruction cache.
// Empties L1 instruction cache.
thrashcodecache:
.leafprologue
push %rbx
xor %eax,%eax
xor %ecx,%ecx
cpuid
/ pushpop 4,%rcx
// pushpop 4,%rcx
0: .rept 32768/(8+9)
.byte 0x0f,0x1f,0x84,0,0,0,0,0 # fat nop x8
.byte 0x66,0x0f,0x1f,0x84,0,0,0,0,0 # fat nop x9
.endr
/ loop 0b
// loop 0b
xor %eax,%eax
xor %ecx,%ecx
cpuid

View file

@ -19,9 +19,9 @@
#include "libc/macros.h"
.source __FILE__
/ Delegates to free().
/
/ @note reduces make dependency toil caused by macros
// Delegates to free().
//
// @note reduces make dependency toil caused by macros
testlib_free:
jmp free
.endfn testlib_free,globl

View file

@ -9,9 +9,9 @@
#define __BENCH_ARRAY(S) \
_Section(".piro.relo.sort.bench.2." #S ",\"aw\",@init_array #")
#define __TEST_PROTOTYPE(S, N, A, K) \
void S##_##N(void); \
const void *const S##_##N##_ptr[] A(S) = {S##_##N}; \
#define __TEST_PROTOTYPE(S, N, A, K) \
void S##_##N(void); \
const void *const S##_##N##_ptr[] A(S##_##N) = {S##_##N}; \
testonly K void S##_##N(void)
#define __TEST_SECTION(NAME, CONTENT) \