[llvm] [CMake] Workaround the incompatibility for executable exports (PR #101741)
Steven Wu via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 2 12:43:30 PDT 2024
https://github.com/cachemeifyoucan created https://github.com/llvm/llvm-project/pull/101741
`LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES` is not completely
compatible with `export_executable_symbols` as the later will be ignored
if the previous is set to NO.
Workaround the issue by setting `ENABLE_EXPORTS` to `On` for executables
that requires symbols to be exported and teach the LLVM configuration to
always respect that.
>From 49c9db2b5c9b7309defb1c2dfa484ca4883a7794 Mon Sep 17 00:00:00 2001
From: Steven Wu <stevenwu at apple.com>
Date: Fri, 2 Aug 2024 12:43:21 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.5
---
llvm/cmake/modules/AddLLVM.cmake | 3 ++-
llvm/tools/llvm-jitlink/CMakeLists.txt | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index bb4e9963d0913..958a29db63cee 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1070,7 +1070,8 @@ macro(add_llvm_executable name)
endif(LLVM_EXPORTED_SYMBOL_FILE)
if (DEFINED LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
- NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES)
+ NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND
+ NOT ENABLE_EXPORTS)
if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS)
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-no_exported_symbols")
diff --git a/llvm/tools/llvm-jitlink/CMakeLists.txt b/llvm/tools/llvm-jitlink/CMakeLists.txt
index 1487e7897f600..9def74116df4b 100644
--- a/llvm/tools/llvm-jitlink/CMakeLists.txt
+++ b/llvm/tools/llvm-jitlink/CMakeLists.txt
@@ -20,6 +20,8 @@ set(LLVM_LINK_COMPONENTS
TargetParser
)
+set(ENABLE_EXPORTS ON)
+
add_llvm_tool(llvm-jitlink
llvm-jitlink.cpp
llvm-jitlink-coff.cpp
More information about the llvm-commits
mailing list