[PATCH] D154794: [llvm] CYGWIN: Fix build of some plugins/library/unittests

Carlo Bramini via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 9 11:01:38 PDT 2023


carlo-bramini created this revision.
carlo-bramini added reviewers: chandlerc, lattner, mstorsjo.
Herald added a subscriber: mtrofin.
Herald added a project: All.
carlo-bramini requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

CYGWIN uses the same format of WIN32 for shared libraries.
As the comment says: "a shared library can't have undefined references", in this case CYGWIN must be handled like WIN32 by CMakeLists.txt, otherwise you will get several errors when linking because some symbols are undefined.
Attached patch fixes this issue and allows to complete the build process for those targets.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154794

Files:
  llvm/examples/Bye/CMakeLists.txt
  llvm/examples/IRTransforms/CMakeLists.txt
  llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
  llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt
  llvm/unittests/Passes/Plugins/CMakeLists.txt


Index: llvm/unittests/Passes/Plugins/CMakeLists.txt
===================================================================
--- llvm/unittests/Passes/Plugins/CMakeLists.txt
+++ llvm/unittests/Passes/Plugins/CMakeLists.txt
@@ -2,7 +2,7 @@
 # but expects them to exist in the process loading the plugin. This doesn't
 # work with DLLs on Windows (where a shared library can't have undefined
 # references), so just skip this testcase on Windows.
-if (NOT WIN32)
+if (NOT WIN32 AND NOT CYGWIN)
   set(LLVM_LINK_COMPONENTS Support Passes Core AsmParser)
   add_llvm_unittest(PluginsTests
     PluginsTest.cpp
Index: llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt
===================================================================
--- llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt
+++ llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt
@@ -2,7 +2,7 @@
 # libraries, but expects them to exist in the process loading the plugin. This 
 # doesn't work with DLLs on Windows (where a shared library can't have undefined
 # references), so just skip this testcase on Windows.
-if (NOT WIN32)
+if (NOT WIN32 AND NOT CYGWIN)
   unset(LLVM_LINK_COMPONENTS)
   add_llvm_library(InlineOrderPlugin MODULE BUILDTREE_ONLY
     InlineOrderPlugin.cpp
Index: llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
===================================================================
--- llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
+++ llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
@@ -2,7 +2,7 @@
 # libraries, but expects them to exist in the process loading the plugin. This 
 # doesn't work with DLLs on Windows (where a shared library can't have undefined
 # references), so just skip this testcase on Windows.
-if (NOT WIN32)
+if (NOT WIN32 AND NOT CYGWIN)
   unset(LLVM_LINK_COMPONENTS)
   add_llvm_library(InlineAdvisorPlugin MODULE BUILDTREE_ONLY
     InlineAdvisorPlugin.cpp
Index: llvm/examples/IRTransforms/CMakeLists.txt
===================================================================
--- llvm/examples/IRTransforms/CMakeLists.txt
+++ llvm/examples/IRTransforms/CMakeLists.txt
@@ -6,7 +6,7 @@
 # but expects them to exist in the process loading the plugin. This doesn't
 # work with DLLs on Windows (where a shared library can't have undefined
 # references), so just skip this example on Windows.
-if (NOT WIN32)
+if (NOT WIN32 AND NOT CYGWIN)
   add_llvm_pass_plugin(ExampleIRTransforms
     SimplifyCFG.cpp
     DEPENDS
Index: llvm/examples/Bye/CMakeLists.txt
===================================================================
--- llvm/examples/Bye/CMakeLists.txt
+++ llvm/examples/Bye/CMakeLists.txt
@@ -6,7 +6,7 @@
 # but expects them to exist in the process loading the plugin. This doesn't
 # work with DLLs on Windows (where a shared library can't have undefined
 # references), so just skip this example on Windows.
-if (NOT WIN32)
+if (NOT WIN32 AND NOT CYGWIN)
   add_llvm_pass_plugin(Bye
     Bye.cpp
     DEPENDS


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154794.538441.patch
Type: text/x-patch
Size: 2976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230709/fbce4393/attachment.bin>


More information about the llvm-commits mailing list