[llvm] [TableGen] fix dependency for gnu-ld (PR #161951)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 4 10:11:19 PDT 2025


https://github.com/aokblast updated https://github.com/llvm/llvm-project/pull/161951

>From 27a68014f9bb9cc627c5dccf88241c3cab091a6a Mon Sep 17 00:00:00 2001
From: ShengYi Hung <aokblast at FreeBSD.org>
Date: Sun, 5 Oct 2025 01:09:38 +0800
Subject: [PATCH] [cmake] disable CMP0179 for gnu-ld

The gnu-ld resolves archive files (static library) in order.
Therefore, we should disable CMP0179 so that CMake will generate the
correct order.
---
 llvm/cmake/modules/AddLLVM.cmake | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 80e59a4df2433..e634e719c5d61 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -268,6 +268,12 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
     endif()
   endif()
 
+  if (LLVM_LINKER_IS_GNULD)
+    if(POLICY CMP0179)
+      cmake_policy(SET CMP0179 OLD)
+    endif()
+  endif()
+
   if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
     include(CheckLinkerFlag)
     # Linkers that support Darwin allow a setting to internalize all symbol exports,



More information about the llvm-commits mailing list