Skip to content

Conversation

ZhongRuoyu
Copy link
Contributor

lld installs symlinks with llvm_install_symlink, which relies on the variable LLVM_USE_SYMLINKS to determine whether to use symlinks or copies. Since that variable is defined in llvm's CMakeLists.txt, it may not be defined when lld is built standalone. In that case, default to using symlinks on Unix platforms. Users can still override this by setting LLVM_USE_SYMLINKS manually.

Fixes #151557.

lld installs symlinks with llvm_install_symlink, which relies on the
variable LLVM_USE_SYMLINKS to determine whether to use symlinks or
copies. Since that variable is defined in llvm's CMakeLists.txt, it may
not be defined when lld is built standalone. In that case, default to
using symlinks on Unix platforms. Users can still override this by
setting LLVM_USE_SYMLINKS manually.

Fixes llvm#151557.

Signed-off-by: Ruoyu Zhong <zhongruoyu@outlook.com>
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the lld label Sep 24, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2025

@llvm/pr-subscribers-lld

Author: Ruoyu Zhong (ZhongRuoyu)

Changes

lld installs symlinks with llvm_install_symlink, which relies on the variable LLVM_USE_SYMLINKS to determine whether to use symlinks or copies. Since that variable is defined in llvm's CMakeLists.txt, it may not be defined when lld is built standalone. In that case, default to using symlinks on Unix platforms. Users can still override this by setting LLVM_USE_SYMLINKS manually.

Fixes #151557.


Full diff: https://github.com/llvm/llvm-project/pull/160471.diff

1 Files Affected:

  • (modified) lld/cmake/modules/AddLLD.cmake (+5)
diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake
index 37f73afa915f4..21008b5645d00 100644
--- a/lld/cmake/modules/AddLLD.cmake
+++ b/lld/cmake/modules/AddLLD.cmake
@@ -73,6 +73,11 @@ macro(add_lld_tool name)
 endmacro()
 
 macro(add_lld_symlink name dest)
+  # In standalone builds, LLVM_USE_SYMLINKS may not be defined.
+  # In that case, default to using symlinks on Unix platforms.
+  if(NOT DEFINED LLVM_USE_SYMLINKS)
+    set(LLVM_USE_SYMLINKS ${CMAKE_HOST_UNIX})
+  endif()
   get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
   if(LLVM_TOOL_LLVM_DRIVER_BUILD
      AND ${dest} IN_LIST LLVM_DRIVER_TOOLS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standalone lld builds don't install symlinks

2 participants