mstorsjo created this revision. mstorsjo added reviewers: MaskRay, phosek. Herald added subscribers: fedor.sergeev, mgorny. mstorsjo requested review of this revision. Herald added projects: clang, LLVM. Herald added a subscriber: cfe-commits.
This is an ELF specific option which isn't supported for Windows/MinGW targets, even if the MinGW linker otherwise uses a ld.bfd like linker interface. In llvm-shlib, there's already a separate if statement for if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW) but I don't know if the solaris linker supports -Bsymbolic-functions or not. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D105148 Files: clang/tools/clang-shlib/CMakeLists.txt llvm/tools/llvm-shlib/CMakeLists.txt Index: llvm/tools/llvm-shlib/CMakeLists.txt =================================================================== --- llvm/tools/llvm-shlib/CMakeLists.txt +++ llvm/tools/llvm-shlib/CMakeLists.txt @@ -50,11 +50,13 @@ # 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() Index: clang/tools/clang-shlib/CMakeLists.txt =================================================================== --- clang/tools/clang-shlib/CMakeLists.txt +++ clang/tools/clang-shlib/CMakeLists.txt @@ -50,6 +50,6 @@ ${_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()
Index: llvm/tools/llvm-shlib/CMakeLists.txt =================================================================== --- llvm/tools/llvm-shlib/CMakeLists.txt +++ llvm/tools/llvm-shlib/CMakeLists.txt @@ -50,11 +50,13 @@ # 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() Index: clang/tools/clang-shlib/CMakeLists.txt =================================================================== --- clang/tools/clang-shlib/CMakeLists.txt +++ clang/tools/clang-shlib/CMakeLists.txt @@ -50,6 +50,6 @@ ${_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()
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits