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

@ -21,9 +21,9 @@
.source __FILE__
.code16 # .code32 .code64
/ Most basic tier of program self-termination.
/
/ @mode long,legacy,real
// Most basic tier of program self-termination.
//
// @mode long,legacy,real
abort: push %bp
mov %sp,%bp
rlcall panic

View file

@ -21,11 +21,11 @@
.source __FILE__
.code16 # .code32 .code64
/ Lightweight universal overridable assert() macro support.
/
/ @see libc/log/__assert_fail.c
/ @mode long,legacy,real
/ @noreturn
// Lightweight universal overridable assert() macro support.
//
// @see libc/log/__assert_fail.c
// @mode long,legacy,real
// @noreturn
__assert_fail:
int3
push %bp

View file

@ -19,7 +19,7 @@
#include "libc/macros.h"
.source __FILE__
/ Did you call a virtual method from a destructor?
// Did you call a virtual method from a destructor?
__cxa_pure_virtual:
push %rbp
mov %rsp,%rbp

View file

@ -21,11 +21,11 @@
.source __FILE__
.code16 # .code32 .code64
/ Triggers breakpoint in software debugger.
/
/ This should work with GDB, Bochs, WinDbg, etc.
/
/ @mode long,legacy,real
// Triggers breakpoint in software debugger.
//
// This should work with GDB, Bochs, WinDbg, etc.
//
// @mode long,legacy,real
DebugBreak:
.softicebp
ret

View file

@ -19,7 +19,7 @@
#include "libc/macros.h"
.source __FILE__
/ Magic words to unbreak build if GCOV flags are passed.
// Magic words to unbreak build if GCOV flags are passed.
__gcov_init:
ret

View file

@ -19,10 +19,10 @@
#include "libc/macros.h"
.source __FILE__
/ @fileoverview Function Instrumentation No-Op Runtime
/
/ The compiler generates synthetic calls to these functions when
/ the -finstrument-functions flag is passed.
// @fileoverview Function Instrumentation No-Op Runtime
//
// The compiler generates synthetic calls to these functions when
// the -finstrument-functions flag is passed.
__cyg_profile_func_enter:
ret

View file

@ -17,17 +17,17 @@
PERFORMANCE OF THIS SOFTWARE.
*/
/ Traditional executable boundaries defined by linker.
/ @see man etext
// Traditional executable boundaries defined by linker.
// @see man etext
_etext = 0
_edata = 0
_end = 0
/ Cosmopolitan executable boundaries defined by linker script.
/ @see libc/elf/elf.lds
/ @see ape/ape.lds
// Cosmopolitan executable boundaries defined by linker script.
// @see libc/elf/elf.lds
// @see ape/ape.lds
_base = 0
ape.xlm = 0
ape_xlm = 0
_ehead = 0
_ereal = 0
__privileged_start = 0
@ -37,7 +37,7 @@
__relo_end = 0
.globl _base
.globl ape.xlm
.globl ape_xlm
.globl __relo_start
.globl __relo_end
.globl __privileged_start
@ -50,7 +50,7 @@
.globl _etext
.weak _base
.weak ape.xlm
.weak ape_xlm
.weak __relo_start
.weak __relo_end
.weak __privileged_start

View file

@ -21,8 +21,8 @@
.source __FILE__
.code16 # .code32 .code64
/ Aborts or hard blocks instruction pointer.
/ @mode long,legacy,real
// Aborts or hard blocks instruction pointer.
// @mode long,legacy,real
panic: push %bp
mov %sp,%bp
.softicebp

View file

@ -18,7 +18,7 @@
*/
#include "libc/macros.h"
/ See -mfunction-return=thunk
// See -mfunction-return=thunk
__x86_return_thunk:
ret
.endfn __x86_return_thunk,weak

View file

@ -20,12 +20,12 @@
#include "libc/notice.inc"
.source __FILE__
/ Canary for -fstack-protector.
/
/ This global is referenced by synthetic code generated by GCC.
/ The -mstack-protector-guard=global flag might need to be passed.
/
/ @note this value is protected by piro
// Canary for -fstack-protector.
//
// This global is referenced by synthetic code generated by GCC.
// The -mstack-protector-guard=global flag might need to be passed.
//
// @note this value is protected by piro
.initbss 200,_init___stack_chk_guard
__stack_chk_guard:
.quad 0

View file

@ -27,7 +27,7 @@
__stack_chk_fail_local:
nop
/ fallthrough
// fallthrough
.endfn __stack_chk_fail_local,weak,hidden
__stack_chk_fail:

View file

@ -19,8 +19,8 @@
#include "libc/macros.h"
.source __FILE__
/ __cxxabiv1::__function_type_info (?)
/ Because Clang in MODE=dbg doesn't respect -fno-rtti
// __cxxabiv1::__function_type_info (?)
// Because Clang in MODE=dbg doesn't respect -fno-rtti
.align 8
_ZTVN10__cxxabiv120__function_type_infoE:
.quad 0

View file

@ -35,272 +35,272 @@ __ubsan_get_current_report_data:
__ubsan_handle_add_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_add_overflow,weak
__ubsan_handle_add_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_add_overflow_abort,weak
__ubsan_handle_alignment_assumption:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_alignment_assumption,weak
__ubsan_handle_alignment_assumption_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_alignment_assumption_abort,weak
__ubsan_handle_builtin_unreachable:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_builtin_unreachable,weak
__ubsan_handle_builtin_unreachable_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_builtin_unreachable_abort,weak
__ubsan_handle_cfi_bad_type:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_cfi_bad_type,weak
__ubsan_handle_cfi_bad_type_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_cfi_bad_type_abort,weak
__ubsan_handle_cfi_check_fail:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_cfi_check_fail,weak
__ubsan_handle_cfi_check_fail_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_cfi_check_fail_abort,weak
__ubsan_handle_divrem_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_divrem_overflow,weak
__ubsan_handle_divrem_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_divrem_overflow_abort,weak
__ubsan_handle_dynamic_type_cache_miss:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_dynamic_type_cache_miss,weak
__ubsan_handle_dynamic_type_cache_miss_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_dynamic_type_cache_miss_abort,weak
__ubsan_handle_float_cast_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_float_cast_overflow,weak
__ubsan_handle_float_cast_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_float_cast_overflow_abort,weak
__ubsan_handle_function_type_mismatch:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_function_type_mismatch,weak
__ubsan_handle_function_type_mismatch_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_function_type_mismatch_abort,weak
__ubsan_handle_implicit_conversion:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_implicit_conversion,weak
__ubsan_handle_implicit_conversion_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_implicit_conversion_abort,weak
__ubsan_handle_invalid_builtin:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_invalid_builtin,weak
__ubsan_handle_invalid_builtin_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_invalid_builtin_abort,weak
__ubsan_handle_load_invalid_value:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_load_invalid_value,weak
__ubsan_handle_load_invalid_value_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_load_invalid_value_abort,weak
__ubsan_handle_missing_return:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_missing_return,weak
__ubsan_handle_missing_return_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_missing_return_abort,weak
__ubsan_handle_mul_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_mul_overflow,weak
__ubsan_handle_mul_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_mul_overflow_abort,weak
__ubsan_handle_negate_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_negate_overflow,weak
__ubsan_handle_negate_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_negate_overflow_abort,weak
__ubsan_handle_nonnull_arg:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nonnull_arg,weak
__ubsan_handle_nonnull_arg_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nonnull_arg_abort,weak
__ubsan_handle_nonnull_return:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nonnull_return,weak
__ubsan_handle_nonnull_return_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nonnull_return_abort,weak
__ubsan_handle_nonnull_return_v1:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nonnull_return_v1,weak
__ubsan_handle_nonnull_return_v1_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nonnull_return_v1_abort,weak
__ubsan_handle_nullability_arg:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nullability_arg,weak
__ubsan_handle_nullability_arg_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nullability_arg_abort,weak
__ubsan_handle_nullability_return_v1:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nullability_return_v1,weak
__ubsan_handle_nullability_return_v1_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_nullability_return_v1_abort,weak
__ubsan_handle_out_of_bounds:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_out_of_bounds,weak
__ubsan_handle_out_of_bounds_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_out_of_bounds_abort,weak
__ubsan_handle_pointer_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_pointer_overflow,weak
__ubsan_handle_pointer_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_pointer_overflow_abort,weak
__ubsan_handle_shift_out_of_bounds:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_shift_out_of_bounds,weak
__ubsan_handle_shift_out_of_bounds_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_shift_out_of_bounds_abort,weak
__ubsan_handle_sub_overflow:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_sub_overflow,weak
__ubsan_handle_sub_overflow_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_sub_overflow_abort,weak
__ubsan_handle_type_mismatch:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_type_mismatch,weak
__ubsan_handle_type_mismatch_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_type_mismatch_abort,weak
__ubsan_handle_type_mismatch_v1:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_type_mismatch_v1,weak
__ubsan_handle_type_mismatch_v1_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_type_mismatch_v1_abort,weak
__ubsan_handle_vla_bound_not_positive:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_vla_bound_not_positive,weak
__ubsan_handle_vla_bound_not_positive_abort:
nop
/ fallthrough
// fallthrough
.endfn __ubsan_handle_vla_bound_not_positive_abort,weak
__ubsan_abort_stub: