summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2024-03-29 20:23:40 +0000
committerLéo Lam <leo@leolam.fr>2024-03-29 20:24:07 +0000
commit00568fbbabef0f9b4f227b7e3d513b3a1878a23e (patch)
tree8f1525c6948ecf24af3d1729ca58a6469e302ec4
parentf62a7262665befb193f9f1986524622f036bb128 (diff)
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.
-rw-r--r--toolchain/ToolchainNX64.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/toolchain/ToolchainNX64.cmake b/toolchain/ToolchainNX64.cmake
index cbf6f119..c518b2db 100644
--- a/toolchain/ToolchainNX64.cmake
+++ b/toolchain/ToolchainNX64.cmake
@@ -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)