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:
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);
|
||||
|
||||
4
third_party/zlib/crcfold.c
vendored
4
third_party/zlib/crcfold.c
vendored
@@ -14,6 +14,8 @@
|
||||
#include "third_party/zlib/deflate.h"
|
||||
#include "third_party/zlib/internal.h"
|
||||
|
||||
#ifndef __llvm__
|
||||
|
||||
asm(".ident\t\"\\n\\n\
|
||||
zlib » crc32 parallelized folding (zlib License)\\n\
|
||||
Copyright 2013 Intel Corporation\\n\
|
||||
@@ -477,3 +479,5 @@ unsigned crc_fold_512to32(struct DeflateState *const s) {
|
||||
return ~crc;
|
||||
CRC_SAVE(s); /* TODO(jart): wut? */
|
||||
}
|
||||
|
||||
#endif /* __llvm__ */
|
||||
|
||||
Reference in New Issue
Block a user