Some weekend updates:

1. The clang-built kernels seem to be working well enough that I could
   complete building a (GCC-built) userland.
2. I tried a larger set of LLVM patches (D51206, D128263, D130006,
   D132465, D135515, D138532, D138741, D138887, D138922, D139535, and
   D140515) and while it does reduce the kernel binary, it did not
   do it much - the kernel only gets about 10k smaller compared to
   the previous build.
   (that is, still ~77k bigger than the GCC-built binary)

text    data    bss     dec     hex
8089416 2295436 728216  11113068        a9926c  bsd.clang+patch+noinline
8066232 2304032 732528  11102792        a96a48  bsd.clang+patchv2+noinline
7862920 2429596 730968  11023484        a8347c  bsd.gcc

3. Also, additionally I also tried to build the userland with clang but
   sadly it fails with some compiler errors:

With `make COMPILER_VERSION=clang CC=clang build`, I'm getting:

In file included from 
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:15,
                 from 
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h:16,
                 from 
/usr/src/gnu/lib/libclang_rt/ubsan_minimal/../../../llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:1:
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_platform.h:25:18: 
error: missing binary operator before token "("
In file included from 
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h:16,
                 from 
/usr/src/gnu/lib/libclang_rt/ubsan_minimal/../../../llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:1:
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:412:
 error: 'constexpr' does not name a type
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:413:
 error: 'constexpr' does not name a type
In file included from 
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang.h:20,
                 from 
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h:63,
                 from 
/usr/src/gnu/lib/libclang_rt/ubsan_minimal/../../../llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:1:
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:
 In function 'typename T::Type __sanitizer::atomic_load(const volatile T*, 
__sanitizer::memory_order)':
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:54:
 error: '__ATOMIC_SEQ_CST' was not declared in this scope
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:
 In function 'void __sanitizer::atomic_store(volatile T*, typename T::Type, 
__sanitizer::memory_order)':
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:79:
 error: '__ATOMIC_SEQ_CST' was not declared in this scope
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:
 In function 'typename T::Type __sanitizer::atomic_load(const volatile T*, 
__sanitizer::memory_order) [with T = __sanitizer::atomic_uint32_t]':
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h:76:   
instantiated from 'typename T::Type __sanitizer::atomic_load_relaxed(const 
volatile T*) [with T = __sanitizer::atomic_uint32_t]'
/usr/src/gnu/lib/libclang_rt/ubsan_minimal/../../../llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:27:
   instantiated from here
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:53:
 error: '__atomic_load' was not declared in this scope
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:
 In function 'typename T::Type __sanitizer::atomic_load(const volatile T*, 
__sanitizer::memory_order) [with T = __sanitizer::atomic_uintptr_t]':
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h:76:   
instantiated from 'typename T::Type __sanitizer::atomic_load_relaxed(const 
volatile T*) [with T = __sanitizer::atomic_uintptr_t]'
/usr/src/gnu/lib/libclang_rt/ubsan_minimal/../../../llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:34:
   instantiated from here
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:53:
 error: '__atomic_load' was not declared in this scope
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:
 In function 'void __sanitizer::atomic_store(volatile T*, typename T::Type, 
__sanitizer::memory_order) [with T = __sanitizer::atomic_uintptr_t]':
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic.h:81:   
instantiated from 'void __sanitizer::atomic_store_relaxed(volatile T*, typename 
T::Type) [with T = __sanitizer::atomic_uintptr_t]'
/usr/src/gnu/lib/libclang_rt/ubsan_minimal/../../../llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp:49:
   instantiated from here
/usr/src/gnu/llvm/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h:79:
 error: '__atomic_store' was not declared in this scope

And with CXX set (`make COMPILER_VERSION=clang CC=clang CXX=clang++ build`),
I'm getting:

/usr/src/gnu/lib/libstdc++-v3/../../gcc/libstdc++-v3/src/compatibility.cc:31:10:
 fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^~~~~~~~~~~~~~~~~~

Though I'm not terribly familiar with the build system so for all
I know it could be that I need to set other options for it to build.

Also, regarding point (2), I have merged all of those into a single
patch, but since it turns out to be over 1.7k lines long, would it be
okay to post it inline, or should I do it as an attachment?

Reply via email to