From fc25f6691b24d8cd472778d2bb73671f12bb30ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Tue, 29 Jun 2021 23:49:31 +0300 Subject: [PATCH] [CMake] Don't use -Bsymbolic-functions for MinGW targets This is an ELF specific option which isn't supported for Windows/MinGW targets, even if the MinGW linker otherwise uses an ld.bfd like linker interface. Differential Revision: https://reviews.llvm.org/D105148 --- tools/llvm-shlib/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/llvm-shlib/CMakeLists.txt b/tools/llvm-shlib/CMakeLists.txt index 03e1383ec8b..76b9a25cbbc 100644 --- a/tools/llvm-shlib/CMakeLists.txt +++ b/tools/llvm-shlib/CMakeLists.txt @@ -50,11 +50,13 @@ if(LLVM_BUILD_LLVM_DYLIB) # Solaris ld does not accept global: *; so there is no way to version *all* global symbols set(LIB_NAMES -Wl,--version-script,${LLVM_LIBRARY_DIR}/tools/llvm-shlib/simple_version_script.map ${LIB_NAMES}) endif() - # Optimize function calls for default visibility definitions to avoid PLT and - # reduce dynamic relocations. - # Note: for -fno-pic default, the address of a function may be different from - # inside and outside libLLVM.so. - target_link_options(LLVM PRIVATE LINKER:-Bsymbolic-functions) + if (NOT MINGW) + # Optimize function calls for default visibility definitions to avoid PLT and + # reduce dynamic relocations. + # Note: for -fno-pic default, the address of a function may be different from + # inside and outside libLLVM.so. + target_link_options(LLVM PRIVATE LINKER:-Bsymbolic-functions) + endif() elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") set(LIB_NAMES -Wl,-all_load ${LIB_NAMES}) endif()