mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
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:
parent
0e36cb3ac4
commit
e75ffde09e
4528 changed files with 7776 additions and 11640 deletions
13
third_party/zlib/crc32.c
vendored
13
third_party/zlib/crc32.c
vendored
|
@ -5,6 +5,7 @@
|
|||
│ Use of this source code is governed by the BSD-style licenses that can │
|
||||
│ be found in the third_party/zlib/LICENSE file. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/weaken.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -18,20 +19,22 @@ Copyright 1995-2017 Jean-loup Gailly and Mark Adler\"");
|
|||
asm(".include \"libc/disclaimer.inc\"");
|
||||
|
||||
void crc_reset(struct DeflateState *const s) {
|
||||
if (X86_HAVE(PCLMUL)) {
|
||||
crc_fold_init(s);
|
||||
if (X86_HAVE(PCLMUL) && weaken(crc_fold_init)) {
|
||||
weaken(crc_fold_init)(s);
|
||||
return;
|
||||
}
|
||||
s->strm->adler = crc32(0L, Z_NULL, 0);
|
||||
}
|
||||
|
||||
void crc_finalize(struct DeflateState *const s) {
|
||||
if (X86_HAVE(PCLMUL)) s->strm->adler = crc_fold_512to32(s);
|
||||
if (X86_HAVE(PCLMUL) && weaken(crc_fold_512to32)) {
|
||||
s->strm->adler = weaken(crc_fold_512to32)(s);
|
||||
}
|
||||
}
|
||||
|
||||
void copy_with_crc(z_streamp strm, Bytef *dst, long size) {
|
||||
if (X86_HAVE(PCLMUL)) {
|
||||
crc_fold_copy(strm->state, dst, strm->next_in, size);
|
||||
if (X86_HAVE(PCLMUL) && weaken(crc_fold_copy)) {
|
||||
weaken(crc_fold_copy)(strm->state, dst, strm->next_in, size);
|
||||
return;
|
||||
}
|
||||
memcpy(dst, strm->next_in, size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue