fa1eef8bbe
Apart from bumping the toolchain Clang's and port's version, this commit completely overhauls the way LLVM toolchain is built. First, it gets rid of a complicated two-stage process of first compiling clang and compiler-rt builtins and then building libunwind, libc++abi, and libc++ -- it is possible to create a complete cross-compilation toolchain in a single CMake invocation with a modern LLVM. Moreover, the old method was inherently unsupported and subtly broken. Next, it utilizes full potential of the Stubs "framework". Now we are even able to compile Clang with -Wl,-z,defs which makes one of the patches obsolete and the whole installation less error-prone. Note that it comes at a cost of complicating the bootstrap process on a completely novel architecture but this hopefully won't happen often. Lastly, it fixes handling of the -no*lib* family of flags in the Serenity LLVM driver and correctly uses -nostartfiles in conjunction with stubs to make necessary CMake configure-time checks succeed. |
||
---|---|---|
.. | ||
0001-clang-Add-support-for-SerenityOS.patch | ||
0002-llvm-Add-support-for-building-LLVM-on-SerenityOS.patch | ||
0003-tools-Support-building-shared-libLLVM-and-libClang-f.patch | ||
0004-compiler-rt-Enable-profile-instrumentation-for-Seren.patch | ||
0005-libcxx-Add-support-for-SerenityOS.patch | ||
0006-clang-Add-fvisibility-inlines-hidden-function-templa.patch | ||
ReadMe.md |
Patches for llvm on SerenityOS
0001-clang-Add-support-for-SerenityOS.patch
Add support for SerenityOS
Adds support for the $arch-pc-serenity
target to the Clang front end.
This makes the compiler look for libraries and headers in the right
places, and enables some security mitigations like stack-smashing
protection and position-independent code by default.
0002-llvm-Add-support-for-building-LLVM-on-SerenityOS.patch
Add support for building LLVM on SerenityOS
Adds SerenityOS #ifdef
s for platform-specific code.
We stub out wait4, as SerenityOS doesn't support querying a child process's resource usage information.
POSIX shm is not supported by SerenityOS yet, so disable it in Orc.
Serenity gives each thread a default of 1MiB of stack. Increase the default stack size for llvm applications when running on SerenityOS.
0003-tools-Support-building-shared-libLLVM-and-libClang-f.patch
Support building shared libLLVM and libClang for SerenityOS
This patch tells CMake that the --whole-archive linker option should be used for specifying the archives whose members will constitute these shared libraries.
Symbol versioning is disabled, as the SerenityOS loader doesn't support it, and the ELF sections that store version data would just waste space.
0004-compiler-rt-Enable-profile-instrumentation-for-Seren.patch
Enable profile instrumentation for SerenityOS
Treat SerenityOS the same as other *NIX platforms that behave close enough to linux to use the pre-canned InstrProfiling implementation.
0005-libcxx-Add-support-for-SerenityOS.patch
Add support for SerenityOS
This commit teaches libc++ about what features are available in our LibC, namely:
- We do not have locale support, so no-op shims should be used in place of the C locale API.
- The number of errno constants defined by us is given by the value of
the
ELAST
macro. - Multithreading is implemented though the pthread library.
- Use libc++'s builtin character type table instead of the one provided by LibC as there's a lot of extra porting work to convince the rest of locale.cpp to use our character type table properly.
0006-clang-Add-fvisibility-inlines-hidden-function-templa.patch
Add -fvisibility-inlines-hidden-function-templates