[llvm] a6ea018 - [llvm] CYGWIN: Fix build of some plugins/library/unittests
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 10 12:44:29 PDT 2023
Author: Carlo Bramini
Date: 2023-07-10T22:43:03+03:00
New Revision: a6ea0185d698dfce0811c37e910d5c08b6a20ed0
URL: https://github.com/llvm/llvm-project/commit/a6ea0185d698dfce0811c37e910d5c08b6a20ed0
DIFF: https://github.com/llvm/llvm-project/commit/a6ea0185d698dfce0811c37e910d5c08b6a20ed0.diff
LOG: [llvm] CYGWIN: Fix build of some plugins/library/unittests
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.
Differential Revision: https://reviews.llvm.org/D154794
Added:
Modified:
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
Removed:
################################################################################
diff --git a/llvm/examples/Bye/CMakeLists.txt b/llvm/examples/Bye/CMakeLists.txt
index 53138092144dd0..7dd04f903323d3 100644
--- a/llvm/examples/Bye/CMakeLists.txt
+++ b/llvm/examples/Bye/CMakeLists.txt
@@ -6,7 +6,7 @@ endif()
# 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
diff --git a/llvm/examples/IRTransforms/CMakeLists.txt b/llvm/examples/IRTransforms/CMakeLists.txt
index 2de442abca071c..3941d5f7d49f24 100644
--- a/llvm/examples/IRTransforms/CMakeLists.txt
+++ b/llvm/examples/IRTransforms/CMakeLists.txt
@@ -6,7 +6,7 @@ endif()
# 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
diff --git a/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt b/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
index b0faf19268fa5c..a0df549e8ea988 100644
--- a/llvm/unittests/Analysis/InlineAdvisorPlugin/CMakeLists.txt
+++ b/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
diff --git a/llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt b/llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt
index 0ed3f04a79b465..e5e5ac4a6fa9fd 100644
--- a/llvm/unittests/Analysis/InlineOrderPlugin/CMakeLists.txt
+++ b/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
diff --git a/llvm/unittests/Passes/Plugins/CMakeLists.txt b/llvm/unittests/Passes/Plugins/CMakeLists.txt
index 5094adb2b5dc15..e90cae167bc222 100644
--- a/llvm/unittests/Passes/Plugins/CMakeLists.txt
+++ b/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
More information about the llvm-commits
mailing list