[flang-commits] [flang] [flang] Export fir-opt symbols for MLIR dialect/pass plugins (PR #212152)
Valentin Churavy via flang-commits
flang-commits at lists.llvm.org
Mon Aug 3 06:32:54 PDT 2026
https://github.com/vchuravy updated https://github.com/llvm/llvm-project/pull/212152
>From 4f718a4a273d1e373d62b8a541472046d2b93473 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy at gmail.com>
Date: Wed, 22 Jul 2026 17:01:22 +0200
Subject: [PATCH 1/2] [flang] Export fir-opt symbols for MLIR dialect/pass
plugins
Lets plugins loaded with --load-dialect-plugin / --load-pass-plugin resolve
MLIR and LLVM symbols against fir-opt, as mlir-opt already does.
Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>
---
flang/tools/fir-opt/CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/flang/tools/fir-opt/CMakeLists.txt b/flang/tools/fir-opt/CMakeLists.txt
index 2697f74c2f0b8..10f2dd3be09e5 100644
--- a/flang/tools/fir-opt/CMakeLists.txt
+++ b/flang/tools/fir-opt/CMakeLists.txt
@@ -1,5 +1,9 @@
add_flang_tool(fir-opt fir-opt.cpp)
llvm_update_compile_flags(fir-opt)
+
+# Let plugins loaded with --load-dialect-plugin / --load-pass-plugin resolve
+# MLIR and LLVM symbols against fir-opt, as mlir-opt already does.
+export_executable_symbols_for_plugins(fir-opt)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
>From 0ceccc89b75f971db729dc5c2a9ffbe13e03ad01 Mon Sep 17 00:00:00 2001
From: Valentin Churavy <v.churavy at gmail.com>
Date: Mon, 3 Aug 2026 15:32:25 +0200
Subject: [PATCH 2/2] Match mlir-opt pattern
---
flang/tools/fir-opt/CMakeLists.txt | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/flang/tools/fir-opt/CMakeLists.txt b/flang/tools/fir-opt/CMakeLists.txt
index 10f2dd3be09e5..588d15f2092ce 100644
--- a/flang/tools/fir-opt/CMakeLists.txt
+++ b/flang/tools/fir-opt/CMakeLists.txt
@@ -1,9 +1,5 @@
add_flang_tool(fir-opt fir-opt.cpp)
-llvm_update_compile_flags(fir-opt)
-# Let plugins loaded with --load-dialect-plugin / --load-pass-plugin resolve
-# MLIR and LLVM symbols against fir-opt, as mlir-opt already does.
-export_executable_symbols_for_plugins(fir-opt)
get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
get_property(extension_libs GLOBAL PROPERTY MLIR_EXTENSION_LIBS)
@@ -55,3 +51,8 @@ mlir_target_link_libraries(fir-opt PRIVATE
MLIRVectorToLLVM
MLIROptLib
)
+
+llvm_update_compile_flags(fir-opt)
+
+mlir_check_all_link_libraries(fir-opt)
+export_executable_symbols_for_plugins(fir-opt)
More information about the flang-commits
mailing list