[lld] [CMake] Export symbols after `target_link_libraries` for lld (PR #115700)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 01:36:23 PST 2024


https://github.com/shatyuka created https://github.com/llvm/llvm-project/pull/115700

Found that lld only exports very few symbols after enable `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS`.

We need to collect `LINK_LIBRARIES` after all `target_link_libraries` calls.


>From 144b60571c8db8af81cc61dc69a8217539d37c02 Mon Sep 17 00:00:00 2001
From: shatyuka <shatyuka at qq.com>
Date: Mon, 11 Nov 2024 17:31:22 +0800
Subject: [PATCH] [CMake] Export symbols after `target_link_libraries` for lld

---
 lld/tools/lld/CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lld/tools/lld/CMakeLists.txt b/lld/tools/lld/CMakeLists.txt
index 8498a91597a930..753b29c5756773 100644
--- a/lld/tools/lld/CMakeLists.txt
+++ b/lld/tools/lld/CMakeLists.txt
@@ -9,7 +9,6 @@ add_lld_tool(lld
   SUPPORT_PLUGINS
   GENERATE_DRIVER
   )
-export_executable_symbols_for_plugins(lld)
 
 function(lld_target_link_libraries target type)
   if (TARGET obj.${target})
@@ -34,6 +33,8 @@ lld_target_link_libraries(lld
   lldWasm
   )
 
+export_executable_symbols_for_plugins(lld)
+
 if(NOT LLD_SYMLINKS_TO_CREATE)
   set(LLD_SYMLINKS_TO_CREATE
       lld-link ld.lld ld64.lld wasm-ld)



More information about the llvm-commits mailing list