mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 09:48:29 +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
|
@ -1,15 +1,18 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_LOG_LOG_H_
|
||||
#define COSMOPOLITAN_LIBC_LOG_LOG_H_
|
||||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/calls/struct/winsize.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
/*───────────────────────────────────────────────────────────────────────────│─╗
|
||||
│ cosmopolitan § liblog ─╬─│┼
|
||||
╚────────────────────────────────────────────────────────────────────────────│*/
|
||||
|
||||
#define kLogFatal 0u
|
||||
#define kLogError 1u
|
||||
#define kLogWarn 2u
|
||||
#define kLogInfo 3u
|
||||
#define kLogVerbose 4u
|
||||
#define kLogDebug 5u
|
||||
#define kLogFatal 0
|
||||
#define kLogError 1
|
||||
#define kLogWarn 2
|
||||
#define kLogInfo 3
|
||||
#define kLogVerbose 4
|
||||
#define kLogDebug 5
|
||||
|
||||
/**
|
||||
* Log level for compile-time DCE.
|
||||
|
@ -27,10 +30,6 @@
|
|||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
struct sigset;
|
||||
struct winsize;
|
||||
typedef struct FILE FILE;
|
||||
|
||||
extern FILE *g_logfile;
|
||||
|
||||
void perror(const char *) relegated; /* print the last system error */
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
/ These function names make it a bit more obvious which signal
|
||||
/ caused the crash, particularly in the GDB GUI. They're coded
|
||||
/ into an array to pinch pennies on code size registering them.
|
||||
// These function names make it a bit more obvious which signal
|
||||
// caused the crash, particularly in the GDB GUI. They're coded
|
||||
// into an array to pinch pennies on code size registering them.
|
||||
|
||||
__oncrash_thunks:
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ __ubsan_handle_type_mismatch_v1_abort:
|
|||
|
||||
__ubsan_handle_add_overflow_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_add_overflow_abort,globl
|
||||
__ubsan_handle_add_overflow:
|
||||
loadstr "add_overflow",si
|
||||
|
@ -58,7 +58,7 @@ __ubsan_handle_add_overflow:
|
|||
|
||||
__ubsan_handle_alignment_assumption_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_alignment_assumption_abort,globl
|
||||
__ubsan_handle_alignment_assumption:
|
||||
loadstr "alignment_assumption",si
|
||||
|
@ -67,7 +67,7 @@ __ubsan_handle_alignment_assumption:
|
|||
|
||||
__ubsan_handle_builtin_unreachable_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_builtin_unreachable_abort,globl
|
||||
__ubsan_handle_builtin_unreachable:
|
||||
loadstr "builtin_unreachable",si
|
||||
|
@ -76,7 +76,7 @@ __ubsan_handle_builtin_unreachable:
|
|||
|
||||
__ubsan_handle_cfi_bad_type_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_cfi_bad_type_abort,globl
|
||||
__ubsan_handle_cfi_bad_type:
|
||||
loadstr "cfi_bad_type",si
|
||||
|
@ -85,7 +85,7 @@ __ubsan_handle_cfi_bad_type:
|
|||
|
||||
__ubsan_handle_cfi_check_fail_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_cfi_check_fail_abort,globl
|
||||
__ubsan_handle_cfi_check_fail:
|
||||
loadstr "cfi_check_fail",si
|
||||
|
@ -94,7 +94,7 @@ __ubsan_handle_cfi_check_fail:
|
|||
|
||||
__ubsan_handle_divrem_overflow_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_divrem_overflow_abort,globl
|
||||
__ubsan_handle_divrem_overflow:
|
||||
loadstr "divrem_overflow",si
|
||||
|
@ -103,7 +103,7 @@ __ubsan_handle_divrem_overflow:
|
|||
|
||||
__ubsan_handle_dynamic_type_cache_miss_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_dynamic_type_cache_miss_abort,globl
|
||||
__ubsan_handle_dynamic_type_cache_miss:
|
||||
loadstr "dynamic_type_cache_miss",si
|
||||
|
@ -112,7 +112,7 @@ __ubsan_handle_dynamic_type_cache_miss:
|
|||
|
||||
__ubsan_handle_function_type_mismatch_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_function_type_mismatch_abort,globl
|
||||
__ubsan_handle_function_type_mismatch:
|
||||
loadstr "function_type_mismatch",si
|
||||
|
@ -121,7 +121,7 @@ __ubsan_handle_function_type_mismatch:
|
|||
|
||||
__ubsan_handle_implicit_conversion_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_implicit_conversion_abort,globl
|
||||
__ubsan_handle_implicit_conversion:
|
||||
loadstr "implicit_conversion",si
|
||||
|
@ -130,7 +130,7 @@ __ubsan_handle_implicit_conversion:
|
|||
|
||||
__ubsan_handle_invalid_builtin_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_invalid_builtin_abort,globl
|
||||
__ubsan_handle_invalid_builtin:
|
||||
loadstr "invalid_builtin",si
|
||||
|
@ -139,7 +139,7 @@ __ubsan_handle_invalid_builtin:
|
|||
|
||||
__ubsan_handle_load_invalid_value_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_load_invalid_value_abort,globl
|
||||
__ubsan_handle_load_invalid_value:
|
||||
loadstr "load_invalid_value (try checking for uninitialized variables)",si
|
||||
|
@ -148,7 +148,7 @@ __ubsan_handle_load_invalid_value:
|
|||
|
||||
__ubsan_handle_missing_return_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_missing_return_abort,globl
|
||||
__ubsan_handle_missing_return:
|
||||
loadstr "missing_return",si
|
||||
|
@ -157,7 +157,7 @@ __ubsan_handle_missing_return:
|
|||
|
||||
__ubsan_handle_mul_overflow_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_mul_overflow_abort,globl
|
||||
__ubsan_handle_mul_overflow:
|
||||
loadstr "mul_overflow",si
|
||||
|
@ -166,7 +166,7 @@ __ubsan_handle_mul_overflow:
|
|||
|
||||
__ubsan_handle_negate_overflow_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_negate_overflow_abort,globl
|
||||
__ubsan_handle_negate_overflow:
|
||||
loadstr "negate_overflow",si
|
||||
|
@ -175,7 +175,7 @@ __ubsan_handle_negate_overflow:
|
|||
|
||||
__ubsan_handle_nonnull_arg_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_nonnull_arg_abort,globl
|
||||
__ubsan_handle_nonnull_arg:
|
||||
loadstr "nonnull_arg",si
|
||||
|
@ -184,7 +184,7 @@ __ubsan_handle_nonnull_arg:
|
|||
|
||||
__ubsan_handle_nonnull_return_v1_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_nonnull_return_v1_abort,globl
|
||||
__ubsan_handle_nonnull_return_v1:
|
||||
loadstr "nonnull_return_v1",si
|
||||
|
@ -197,7 +197,7 @@ __ubsan_hop:
|
|||
|
||||
__ubsan_handle_nullability_arg_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_nullability_arg_abort,globl
|
||||
__ubsan_handle_nullability_arg:
|
||||
loadstr "nullability_arg",si
|
||||
|
@ -206,7 +206,7 @@ __ubsan_handle_nullability_arg:
|
|||
|
||||
__ubsan_handle_nullability_return_v1_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_nullability_return_v1_abort,globl
|
||||
__ubsan_handle_nullability_return_v1:
|
||||
loadstr "nullability_return_v1",si
|
||||
|
@ -215,7 +215,7 @@ __ubsan_handle_nullability_return_v1:
|
|||
|
||||
__ubsan_handle_pointer_overflow_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_pointer_overflow_abort,globl
|
||||
__ubsan_handle_pointer_overflow:
|
||||
loadstr "pointer_overflow",si
|
||||
|
@ -224,7 +224,7 @@ __ubsan_handle_pointer_overflow:
|
|||
|
||||
__ubsan_handle_shift_out_of_bounds_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_shift_out_of_bounds_abort,globl
|
||||
__ubsan_handle_shift_out_of_bounds:
|
||||
loadstr "shift_out_of_bounds",si
|
||||
|
@ -233,7 +233,7 @@ __ubsan_handle_shift_out_of_bounds:
|
|||
|
||||
__ubsan_handle_sub_overflow_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_sub_overflow_abort,globl
|
||||
__ubsan_handle_sub_overflow:
|
||||
loadstr "sub_overflow",si
|
||||
|
@ -242,7 +242,7 @@ __ubsan_handle_sub_overflow:
|
|||
|
||||
__ubsan_handle_vla_bound_not_positive_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_vla_bound_not_positive_abort,globl
|
||||
__ubsan_handle_vla_bound_not_positive:
|
||||
loadstr "vla_bound_not_positive",si
|
||||
|
@ -251,7 +251,7 @@ __ubsan_handle_vla_bound_not_positive:
|
|||
|
||||
__ubsan_handle_nonnull_return_abort:
|
||||
nop
|
||||
/ fallthrough
|
||||
// fallthrough
|
||||
.endfn __ubsan_handle_nonnull_return_abort,globl
|
||||
__ubsan_handle_nonnull_return:
|
||||
loadstr "nonnull_return",si
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.text.unlikely
|
||||
.source __FILE__
|
||||
|
||||
/ Code-size saving thunk for CHECK_EQ() in NDEBUG mode.
|
||||
// Code-size saving thunk for CHECK_EQ() in NDEBUG mode.
|
||||
__check_fail_eq:
|
||||
loadstr "==",dx
|
||||
jmp __check_fail_ndebug
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.text.unlikely
|
||||
.source __FILE__
|
||||
|
||||
/ Code-size saving thunk for CHECK_GE() in NDEBUG mode.
|
||||
// Code-size saving thunk for CHECK_GE() in NDEBUG mode.
|
||||
__check_fail_ge:
|
||||
loadstr ">=",dx
|
||||
jmp __check_fail_ndebug
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.text.unlikely
|
||||
.source __FILE__
|
||||
|
||||
/ Code-size saving thunk for CHECK_GT() in NDEBUG mode.
|
||||
// Code-size saving thunk for CHECK_GT() in NDEBUG mode.
|
||||
__check_fail_gt:
|
||||
loadstr ">",dx
|
||||
jmp __check_fail_ndebug
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.text.unlikely
|
||||
.source __FILE__
|
||||
|
||||
/ Code-size saving thunk for CHECK_LE() in NDEBUG mode.
|
||||
// Code-size saving thunk for CHECK_LE() in NDEBUG mode.
|
||||
__check_fail_le:
|
||||
loadstr "<=",dx
|
||||
jmp __check_fail_ndebug
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.text.unlikely
|
||||
.source __FILE__
|
||||
|
||||
/ Code-size saving thunk for CHECK_LT() in NDEBUG mode.
|
||||
// Code-size saving thunk for CHECK_LT() in NDEBUG mode.
|
||||
__check_fail_lt:
|
||||
loadstr "<",dx
|
||||
jmp __check_fail_ndebug
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
.text.unlikely
|
||||
.source __FILE__
|
||||
|
||||
/ Code-size saving thunk for CHECK_NE() in NDEBUG mode.
|
||||
// Code-size saving thunk for CHECK_NE() in NDEBUG mode.
|
||||
__check_fail_ne:
|
||||
loadstr "!=",dx
|
||||
jmp __check_fail_ndebug
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue