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

@ -65,7 +65,6 @@ textstartup int _fflushregister(FILE *f) {
size_t i;
struct StdioFlush *sf;
sf = &g_fflush;
sf = sf;
if (!sf->handles.p) {
sf->handles.p = &sf->handles_initmem[0];
pushmov(&sf->handles.n, ARRAYLEN(sf->handles_initmem));

View file

@ -19,8 +19,8 @@
#include "libc/macros.h"
.source __FILE__
/ Reads uint8_t from standard input.
/ @return %al has result w/ rest of %rax cleared
// Reads uint8_t from standard input.
// @return %al has result w/ rest of %rax cleared
getchar:mov stdin(%rip),%rdi
jmp fgetc
.endfn getchar,globl

View file

@ -19,8 +19,8 @@
#include "libc/macros.h"
.source __FILE__
/ Reads Thompson-Pike encoded varint from standard input.
/ @return %eax has result w/ rest of %rax cleared
// Reads Thompson-Pike encoded varint from standard input.
// @return %eax has result w/ rest of %rax cleared
getwchar:
mov stdin(%rip),%rdi
jmp fgetwc

View file

@ -19,9 +19,9 @@
#include "libc/macros.h"
.source __FILE__
/ Writes wide character to stream.
/ @param %edi is the wide character
/ @param %rsi is the FILE stream pointer
/ @return %eax is set to %edi param or -1 on error
// Writes wide character to stream.
// @param %edi is the wide character
// @param %rsi is the FILE stream pointer
// @return %eax is set to %edi param or -1 on error
putwc: jmp fputwc
.endfn putwc,globl

View file

@ -80,7 +80,6 @@ compatfn int64_t ftello(FILE *) paramsnonnull();
int system(const char *);
int systemexec(const char *);
int systemecho(const char *);
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § standard i/o » formatting

View file

@ -1,24 +0,0 @@
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2020 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/stdio/stdio.h"
int systemecho(const char *cmd) {
fprintf(stderr, "+ %s\n", cmd);
return system(cmd);
}