[clang] bf6770f - [CMake] Don't use -Bsymbolic-functions for MinGW targets

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 30 12:54:53 PDT 2021


Author: Martin Storsjö
Date: 2021-06-30T22:54:26+03:00
New Revision: bf6770f9bd606643c8ea8a7ab03da5da5960e98e

URL: https://github.com/llvm/llvm-project/commit/bf6770f9bd606643c8ea8a7ab03da5da5960e98e
DIFF: https://github.com/llvm/llvm-project/commit/bf6770f9bd606643c8ea8a7ab03da5da5960e98e.diff

LOG: [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

Added: 
    

Modified: 
    clang/tools/clang-shlib/CMakeLists.txt
    llvm/tools/llvm-shlib/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt
index d08cf89383282..9c1f8ea452b36 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -50,6 +50,6 @@ add_clang_library(clang-cpp
                   ${_DEPS})
 # Optimize function calls for default visibility definitions to avoid PLT and
 # reduce dynamic relocations.
-if (NOT APPLE)
+if (NOT APPLE AND NOT MINGW)
   target_link_options(clang-cpp PRIVATE LINKER:-Bsymbolic-functions)
 endif()

diff  --git a/llvm/tools/llvm-shlib/CMakeLists.txt b/llvm/tools/llvm-shlib/CMakeLists.txt
index 03e1383ec8b4f..76b9a25cbbcdc 100644
--- a/llvm/tools/llvm-shlib/CMakeLists.txt
+++ b/llvm/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 
diff erent 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 
diff erent 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()


        


More information about the cfe-commits mailing list