On Sun, Dec 25 2022, Koakuma <[email protected]> wrote:
> Some weekend updates:
>
> 1. The clang-built kernels seem to be working well enough that I could
> complete building a (GCC-built) userland.
That's good to know, I think I haven't tested that after we moved to
llvm 13.
> 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)
That's a nice improvement but a lot of patches. patrick@ and I started
working on an update to llvm 15. No timeline yet but maybe some/all of
the changes you mentioned would already be integrated in that update?
(Or conclicting with it...)
> 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:
As mentioned privately better remove sparc64 from GCC4_ARCHS in
bsd.own.mk and let the Makefiles pick up clang/clang++.
> 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?
>
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE