diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2022-01-19 20:54:34 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2022-01-24 10:41:47 +0000 |
commit | 4055c393fc996cf087bda3683b206594bb32bcb6 (patch) | |
tree | b5368ac23878323b99d61cc5c28199bb97664905 /Meta/CMake | |
parent | ad649c48daf5fe5069d41a4ea52fc1beff6d93b6 (diff) | |
download | serenity-4055c393fc996cf087bda3683b206594bb32bcb6.zip |
Toolchain: Add support for building the userland with the mold linker
This commit adds support for building the SerenityOS userland with the
new [mold linker].
This is not enabled by default yet; to link using mold, run the
`Toolchain/BuildMold.sh` script to build the latest release of mold, and
set the `ENABLE_MOLD_LINKER` CMake variable to ON. This option relies on
toolchain support that has been added just recently, so you might need
to rebuild your toolchain for mold to work.
[mold linker]: https://github.com/rui314/mold
Diffstat (limited to 'Meta/CMake')
-rw-r--r-- | Meta/CMake/serenity_options.cmake | 1 | ||||
-rw-r--r-- | Meta/CMake/utils.cmake | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Meta/CMake/serenity_options.cmake b/Meta/CMake/serenity_options.cmake index 7c74bf1a08..a612836852 100644 --- a/Meta/CMake/serenity_options.cmake +++ b/Meta/CMake/serenity_options.cmake @@ -11,3 +11,4 @@ serenity_option(ENABLE_KERNEL_ADDRESS_SANITIZER OFF CACHE BOOL "Enable kernel ad serenity_option(ENABLE_KERNEL_COVERAGE_COLLECTION OFF CACHE BOOL "Enable KCOV and kernel coverage instrumentation in gcc/clang") serenity_option(ENABLE_KERNEL_LTO OFF CACHE BOOL "Build the kernel with link-time optimization") serenity_option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS OFF CACHE BOOL "Enable -Og and -ggdb3 options for Kernel code for easier debugging") +serenity_option(ENABLE_MOLD_LINKER OFF CACHE BOOL "Link the SerenityOS userland with the mold linker") diff --git a/Meta/CMake/utils.cmake b/Meta/CMake/utils.cmake index 94c90a4b9f..caee954fcd 100644 --- a/Meta/CMake/utils.cmake +++ b/Meta/CMake/utils.cmake @@ -57,7 +57,9 @@ function(serenity_libc target_name fs_name) target_link_libraries(${target_name} clang_rt.builtins) # FIXME: Implement -static-libstdc++ in the next toolchain update. target_link_options(${target_name} PRIVATE -nostdlib++ -Wl,-Bstatic -lc++ -Wl,-Bdynamic) - target_link_options(${target_name} PRIVATE -Wl,--no-dependent-libraries) + if (NOT ENABLE_MOLD_LINKER) + target_link_options(${target_name} PRIVATE -Wl,--no-dependent-libraries) + endif() endif() target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) serenity_generated_sources(${target_name}) |