build: allow specifying custom linker flags

This is useful for people who want to link using recent versions of
mold which are smart enough to e.g. optimise GOT loads; we need to
pass --no-relax to disable those optimisations in order to get matching
instructions.
This commit is contained in:
Léo Lam 2024-03-29 20:23:40 +00:00
parent f62a726266
commit 00568fbbab
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 3 additions and 0 deletions

View File

@ -41,6 +41,9 @@ add_link_options(-fPIC -Wl,-Bsymbolic-functions -shared)
if (DEFINED UKING_LINKER)
message(STATUS "Using custom linker: ${UKING_LINKER}")
add_link_options(-fuse-ld=${UKING_LINKER})
if (DEFINED UKING_LINKER_FLAGS)
add_link_options(${UKING_LINKER_FLAGS})
endif()
else()
# Use lld for performance reasons (and because we don't want a dependency on GNU tools)
add_link_options(-fuse-ld=lld)