[clang] [lldb] [llvm] [cmake] Build executables with -no_exported_symbols when building Apple toolchain (PR #87684)
Dan Liew via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 5 13:05:19 PDT 2024
================
@@ -1029,6 +1038,11 @@ 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)
----------------
delcypher wrote:
Currently we silently ignore `LLVM_ENABLE_EXPORTED_SYMBOLS_IN_EXECUTABLES` if the linker doesn't support the flag. It would probably better to produce a fatal error to avoid an invalid configuration being used.
```cmake
if (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 \" -Wl,-no_exported_symbols\""
endif()
endif()
```
https://github.com/llvm/llvm-project/pull/87684
More information about the cfe-commits
mailing list