1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:17:44 +00:00

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
This commit is contained in:
Daniel Bertalan 2022-01-19 20:54:34 +01:00 committed by Brian Gianforcaro
parent ad649c48da
commit 4055c393fc
7 changed files with 60 additions and 1 deletions

View file

@ -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})