Author: Mateusz MikuĊ‚a
Date: 2025-05-02T11:02:11+03:00
New Revision: 9bc20fbbadb18a1c3415d4442066ed35a6bcc175

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

LOG: [Clang][Cygwin] Disable shared libs on Cygwin by default (#138119)

This change follows MinGW decisions, otherwise build with GCC fail with:
```
FAILED: bin/msys-clang-cpp-21.0git.dll lib/libclang-cpp.dll.a
...
/usr/lib/gcc/x86_64-pc-msys/13.3.0/../../../../x86_64-pc-msys/bin/ld: error: 
export ordinal too large: 92250
```

Co-authored-by: jeremyd2019 <git...@jdrake.com>

Added: 
    

Modified: 
    clang/tools/CMakeLists.txt
    clang/tools/libclang/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index 9634eb12080c8..50e3d694236ac 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -26,9 +26,10 @@ endif()
 add_clang_subdirectory(c-index-test)
 
 add_clang_subdirectory(clang-refactor)
-# For MinGW we only enable shared library if LLVM_LINK_LLVM_DYLIB=ON.
+# For MinGW/Cygwin we only enable shared library if LLVM_LINK_LLVM_DYLIB=ON.
 # Without that option resulting library is too close to 2^16 DLL exports limit.
-if(UNIX OR (MSVC AND LLVM_BUILD_LLVM_DYLIB_VIS) OR (MINGW AND 
LLVM_LINK_LLVM_DYLIB))
+if((UNIX AND NOT CYGWIN) OR (MSVC AND LLVM_BUILD_LLVM_DYLIB_VIS) OR
+  ((MINGW OR CYGWIN) AND LLVM_LINK_LLVM_DYLIB))
   add_clang_subdirectory(clang-shlib)
 endif()
 

diff  --git a/clang/tools/libclang/CMakeLists.txt 
b/clang/tools/libclang/CMakeLists.txt
index 299c14660f3d4..37a939ffcada7 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -106,7 +106,8 @@ if (LLVM_EXPORTED_SYMBOL_FILE)
                      DEPENDS ${LIBCLANG_VERSION_SCRIPT_FILE})
 endif()
 
-if(LLVM_ENABLE_PIC OR (WIN32 AND NOT LIBCLANG_BUILD_STATIC))
+if((NOT (WIN32 OR CYGWIN) AND LLVM_ENABLE_PIC) OR
+  ((WIN32 OR CYGWIN) AND NOT LIBCLANG_BUILD_STATIC))
   set(ENABLE_SHARED SHARED)
 endif()
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to