1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:27:43 +00:00

Meta: Link Lagom with LLD by default and allow configuring the linker

This ports over the `LADYBIRD_USE_LLD` option from the standalone
Ladybird build and generalizes it to work for mold as well: the
`LAGOM_USE_LINKER` variable can be set to the desired name of the
linker. If it's empty, we default to trying LLD and Mold on ELF
platforms (in this order).
This commit is contained in:
Daniel Bertalan 2023-09-05 07:40:57 +02:00 committed by Andreas Kling
parent 07039af982
commit dac443fbff
6 changed files with 46 additions and 23 deletions

View file

@ -27,7 +27,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(cmake/EnableLLD.cmake)
include(use_linker)
if (ENABLE_ADDRESS_SANITIZER)
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)

View file

@ -1,17 +0,0 @@
# Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
#
# SPDX-License-Identifier: BSD-2-Clause
#
option(LADYBIRD_USE_LLD "Use llvm lld to link application" ON)
if (LADYBIRD_USE_LLD AND NOT APPLE)
find_program(LLD_LINKER NAMES "ld.lld")
if (NOT LLD_LINKER)
message(INFO "LLD not found, cannot use to link. Disabling option...")
set(LADYBIRD_USE_LLD OFF CACHE BOOL "" FORCE)
endif()
endif()
if (LADYBIRD_USE_LLD AND NOT APPLE)
add_link_options(-fuse-ld=lld)
add_compile_options(-ggnu-pubnames)
add_link_options(LINKER:--gdb-index)
endif()