[llvm] [Build] Turn off -undefined-version when building with lld (PR #85087)
Alastair Houghton via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 13 07:34:47 PDT 2024
https://github.com/al45tair created https://github.com/llvm/llvm-project/pull/85087
Newer lld defaults to `-no-undefined-version`, which breaks the build because of various symbols that are (a) versioned and (b) not always defined (depending on platform).
rdar://123436280
>From cef0f70c9093833e8721f4e0864094ae901daf1f Mon Sep 17 00:00:00 2001
From: Alastair Houghton <ahoughton at apple.com>
Date: Thu, 22 Feb 2024 11:41:04 +0000
Subject: [PATCH] [Build] Turn off -undefined-version when building with lld
Newer lld defaults to `-no-undefined-version`, which breaks the build
because of various symbols that are (a) versioned and (b) not always
defined (depending on platform).
rdar://123436280
---
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 374f5e085d9118..f73939aa33e06f 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -260,6 +260,12 @@ if (NOT DEFINED LLVM_LINKER_DETECTED AND NOT WIN32)
endif()
function(add_link_opts target_name)
+ # Newer lld defaults to no-undefined-version, which we don't expect
+ if(LLVM_LINKER_IS_LLD)
+ set_property(TARGET ${target_name} APPEND_STRING PROPERTY
+ LINK_FLAGS " -Wl,-undefined-version")
+ endif()
+
get_llvm_distribution(${target_name} in_distribution in_distribution_var)
if(NOT in_distribution)
# Don't LTO optimize targets that aren't part of any distribution.
More information about the llvm-commits
mailing list