Add preliminary support for cosmocc -mclang

C++ code compiles very slowly with cosmocc, possibly because we're using
LLVM LIBCXX with GCC, and LLVM doesn't work as hard to make GCC go fast.
Therefore, it should be possible, to ask cosmocc to favor Clang over GCC
under the hood. On llamafile, my intention's to use this to make certain
files, e.g. llama.cpp/common.cpp, go from taking 17 seconds to 5 seconds

This new -mclang flag isn't ready for production yet since there's still
the question of how to get Clang to generate SJLJ exception code. If you
use this, then it's recommended you also pass -fno-exceptions.

The tradeoff is we're adding a 121mb binary to the cosmocc distribution.
There are no plans as of yet to fully migrate to Clang since GCC is very
good and has always treated us well.
This commit is contained in:
Justine Tunney 2024-08-26 12:29:59 -07:00
parent 111ec9a989
commit e7b586e7f8
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 42 additions and 16 deletions

View file

@ -119,7 +119,7 @@ void __morph_begin(void) libcesque;
void __morph_end(void) libcesque;
void __jit_begin(void) libcesque;
void __jit_end(void) libcesque;
void __clear_cache(void *, void *) libcesque;
void __clear_cache(void *, void *);
/* portability */
bool32 IsGenuineBlink(void) libcesque;
bool32 IsCygwin(void) libcesque;