llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lto

@llvm/pr-subscribers-clang

Author: Tomohiro Kashiwada (kikairoya)

<details>
<summary>Changes</summary>

Fixes #<!-- -->152328

For exporting:
Since the declaration/definition of `getPollyPluginInfo` is embedded into the 
LLVM DLL using `add_llvm_pass_plugin`, which defines `LLVM_BUILD_STATIC` by the 
effect of `DISABLE_LLVM_LINK_LLVM_DYLIB`, it must be declared with 
`LLVM_ALWAYS_EXPORT`.

For importing:
The annotation `LLVM_ABI` is required in the body of the macro 
`HANDLE_EXTENTION`, which generates the declaration of  `getPollyPluginInfo` 
from the CMake-generated file `"llvm/Support/Extension.def"`.

---
Full diff: https://github.com/llvm/llvm-project/pull/156440.diff


8 Files Affected:

- (modified) clang/lib/CodeGen/BackendUtil.cpp (+1-1) 
- (modified) flang/lib/Frontend/FrontendActions.cpp (+1-1) 
- (modified) llvm/docs/WritingAnLLVMNewPMPass.rst (+2-2) 
- (modified) llvm/lib/Extensions/Extensions.cpp (+1-1) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+1-1) 
- (modified) llvm/tools/bugpoint/bugpoint.cpp (+1-1) 
- (modified) llvm/tools/opt/NewPMDriver.cpp (+1-1) 
- (modified) polly/include/polly/RegisterPasses.h (+3-1) 


``````````diff
diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 3f095c03397fd..2e6f9e90f2db6 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -94,7 +94,7 @@ using namespace clang;
 using namespace llvm;
 
 #define HANDLE_EXTENSION(Ext)                                                  
\
-  llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+  LLVM_ABI llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 #include "llvm/Support/Extension.def"
 
 namespace llvm {
diff --git a/flang/lib/Frontend/FrontendActions.cpp 
b/flang/lib/Frontend/FrontendActions.cpp
index 3bef6b1c31825..e61dee5e26636 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -87,7 +87,7 @@ constexpr llvm::StringLiteral timingIdBackend =
 
 // Declare plugin extension function declarations.
 #define HANDLE_EXTENSION(Ext)                                                  
\
-  llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+  LLVM_ABI llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 #include "llvm/Support/Extension.def"
 
 /// Save the given \c mlirModule to a temporary .mlir file, in a location
diff --git a/llvm/docs/WritingAnLLVMNewPMPass.rst 
b/llvm/docs/WritingAnLLVMNewPMPass.rst
index ea30d637347f1..5e41a939081a3 100644
--- a/llvm/docs/WritingAnLLVMNewPMPass.rst
+++ b/llvm/docs/WritingAnLLVMNewPMPass.rst
@@ -254,7 +254,7 @@ See the definition of ``add_llvm_pass_plugin`` for more 
CMake details.
 The pass must provide at least one of two entry points for the new pass 
manager,
 one for static registration and one for dynamically loaded plugins:
 
-- ``llvm::PassPluginLibraryInfo get##Name##PluginInfo();``
+- ``LLVM_ABI llvm::PassPluginLibraryInfo get##Name##PluginInfo();``
 - ``extern "C" ::llvm::PassPluginLibraryInfo llvmGetPassPluginInfo() 
LLVM_ATTRIBUTE_WEAK;``
 
 Pass plugins are compiled and linked dynamically by default. Setting
@@ -268,7 +268,7 @@ To make ``PassBuilder`` aware of statically linked pass 
plugins:
 .. code-block:: c++
 
     // Declare plugin extension function declarations.
-    #define HANDLE_EXTENSION(Ext) llvm::PassPluginLibraryInfo 
get##Ext##PluginInfo();
+    #define HANDLE_EXTENSION(Ext) LLVM_ABI llvm::PassPluginLibraryInfo 
get##Ext##PluginInfo();
     #include "llvm/Support/Extension.def"
 
     ...
diff --git a/llvm/lib/Extensions/Extensions.cpp 
b/llvm/lib/Extensions/Extensions.cpp
index 0d25cbda38e00..67b1fa087e0c1 100644
--- a/llvm/lib/Extensions/Extensions.cpp
+++ b/llvm/lib/Extensions/Extensions.cpp
@@ -1,6 +1,6 @@
 #include "llvm/Passes/PassPlugin.h"
 #define HANDLE_EXTENSION(Ext)                                                  
\
-               llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+  LLVM_ABI llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 #include "llvm/Support/Extension.def"
 
 
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index ce42fc526beac..37ff7a4968e41 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -178,7 +178,7 @@ Error Config::addSaveTemps(std::string OutputFileName, bool 
UseInputModulePath,
 }
 
 #define HANDLE_EXTENSION(Ext)                                                  
\
-  llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+  LLVM_ABI llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 #include "llvm/Support/Extension.def"
 #undef HANDLE_EXTENSION
 
diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp
index 87581e80a2496..741374bfaf162 100644
--- a/llvm/tools/bugpoint/bugpoint.cpp
+++ b/llvm/tools/bugpoint/bugpoint.cpp
@@ -93,7 +93,7 @@ class AddToDriver : public legacy::FunctionPassManager {
 }
 
 #define HANDLE_EXTENSION(Ext)                                                  
\
-  llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+  LLVM_ABI llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 #include "llvm/Support/Extension.def"
 
 int main(int argc, char **argv) {
diff --git a/llvm/tools/opt/NewPMDriver.cpp b/llvm/tools/opt/NewPMDriver.cpp
index b9b8929a0f703..81909ea94f227 100644
--- a/llvm/tools/opt/NewPMDriver.cpp
+++ b/llvm/tools/opt/NewPMDriver.cpp
@@ -344,7 +344,7 @@ static void registerEPCallbacks(PassBuilder &PB) {
 }
 
 #define HANDLE_EXTENSION(Ext)                                                  
\
-  llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
+  LLVM_ABI llvm::PassPluginLibraryInfo get##Ext##PluginInfo();
 #include "llvm/Support/Extension.def"
 #undef HANDLE_EXTENSION
 
diff --git a/polly/include/polly/RegisterPasses.h 
b/polly/include/polly/RegisterPasses.h
index 3a81e1ba7487d..3c358c8d77d4c 100644
--- a/polly/include/polly/RegisterPasses.h
+++ b/polly/include/polly/RegisterPasses.h
@@ -13,6 +13,8 @@
 #ifndef POLLY_REGISTER_PASSES_H
 #define POLLY_REGISTER_PASSES_H
 
+#include "llvm/Support/Compiler.h"
+
 namespace llvm {
 class PassRegistry;
 class PassBuilder;
@@ -27,6 +29,6 @@ void initializePollyPasses(llvm::PassRegistry &Registry);
 void registerPollyPasses(llvm::PassBuilder &PB);
 } // namespace polly
 
-llvm::PassPluginLibraryInfo getPollyPluginInfo();
+LLVM_ALWAYS_EXPORT llvm::PassPluginLibraryInfo getPollyPluginInfo();
 
 #endif

``````````

</details>


https://github.com/llvm/llvm-project/pull/156440
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to