https://github.com/cyndyishida created https://github.com/llvm/llvm-project/pull/87846
* It is possible to setup llvm-project builds without going through `llvm/CMakeList.txt` so the fatal error handling should be smarter. * Disable option on Apple style lldb-linux builds. >From 75949b4fae9634a032dd97a34bd3546367dbab5a Mon Sep 17 00:00:00 2001 From: Cyndy Ishida <cyndy_ish...@apple.com> Date: Fri, 5 Apr 2024 17:08:46 -0700 Subject: [PATCH] [cmake] Prevent implicitly passing `-no_exported_symbols` * Its possible to setup llvm-project builds without going through `llvm/CMakeList.txt` so the fatal error handling should be smarter. * Disable option on Apple style lldb-linux builds. --- lldb/cmake/caches/Apple-lldb-Linux.cmake | 1 + llvm/cmake/modules/AddLLVM.cmake | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lldb/cmake/caches/Apple-lldb-Linux.cmake b/lldb/cmake/caches/Apple-lldb-Linux.cmake index b2d3cf595fe18d..9258f01e2ec26a 100644 --- a/lldb/cmake/caches/Apple-lldb-Linux.cmake +++ b/lldb/cmake/caches/Apple-lldb-Linux.cmake @@ -1,4 +1,5 @@ include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake) +set(LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES ON CACHE BOOL "") set(LLVM_DISTRIBUTION_COMPONENTS lldb diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 81398ddb5c92e3..693fd5669f63f9 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1038,9 +1038,15 @@ macro(add_llvm_executable name) add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) endif(LLVM_EXPORTED_SYMBOL_FILE) - if (NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) + if (DEFINED LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES AND + NOT LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES) + if(LLVM_LINKER_SUPPORTS_NO_EXPORTED_SYMBOLS) set_property(TARGET ${name} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-no_exported_symbols") + else() + message(FATAL_ERROR + "LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES cannot be disabled when linker does not support \"-no_exported_symbols\"") + endif() endif() if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits