[Mlir-commits] [mlir] [MLIR][build] Fix undefined references in debug shared libs (#189206) (PR #189207)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Mar 28 20:28:24 PDT 2026
https://github.com/dwrank created https://github.com/llvm/llvm-project/pull/189207
Fixes undefined references in debug shared libs when building MLIR:
-DLLVM_ENABLE_PROJECTS="mlir"
-DCMAKE_BUILD_TYPE=Debug
-DBUILD_SHARED_LIBS=1
Debug build (-O0) disables dead code elimination, resulting in undefined references in the following shared libs:
MLIROpenMPDialect (needs to link with TargetParser)
MLIRXeVMDialect (needs to link with TargetParser and MLIROpenMPDialect)
MLIRNVVMDialect (needs to link with TargetParser and MLIROpenMPDialect)
Assisted-by: Claude Code
>From 996cbd29f6e88fa6950fa978fa05650f380d4c14 Mon Sep 17 00:00:00 2001
From: Daniel Rank <dwrank at gmail.com>
Date: Sat, 28 Mar 2026 19:36:20 -0700
Subject: [PATCH] [MLIR][build] Fix undefined references in debug shared libs
(#189206)
Debug build (-O0) disables dead code elimination, resulting
in undefined references in the following shared libs:
MLIROpenMPDialect (needs to link with TargetParser)
MLIRXeVMDialect (needs to link with TargetParser and MLIROpenMPDialect)
MLIRNVVMDialect (needs to link with TargetParser and MLIROpenMPDialect)
Assisted-by: Claude Code
---
mlir/lib/Dialect/LLVMIR/CMakeLists.txt | 4 ++++
mlir/lib/Dialect/OpenMP/CMakeLists.txt | 3 +++
2 files changed, 7 insertions(+)
diff --git a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
index 21b60ae747a71..494a1e4c3ee97 100644
--- a/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/lib/Dialect/LLVMIR/CMakeLists.txt
@@ -60,11 +60,13 @@ add_mlir_dialect_library(MLIRNVVMDialect
LINK_COMPONENTS
AsmParser
Core
+ TargetParser
LINK_LIBS PUBLIC
MLIRIR
MLIRLLVMDialect
MLIRGPUDialect
+ MLIROpenMPDialect
MLIRSideEffectInterfaces
MLIRInferIntRangeInterface
)
@@ -128,10 +130,12 @@ add_mlir_dialect_library(MLIRXeVMDialect
LINK_COMPONENTS
AsmParser
Core
+ TargetParser
LINK_LIBS PUBLIC
MLIRDialectUtils
MLIRIR
MLIRLLVMDialect
+ MLIROpenMPDialect
MLIRSideEffectInterfaces
)
diff --git a/mlir/lib/Dialect/OpenMP/CMakeLists.txt b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
index f3c02da458508..41c68b4244590 100644
--- a/mlir/lib/Dialect/OpenMP/CMakeLists.txt
+++ b/mlir/lib/Dialect/OpenMP/CMakeLists.txt
@@ -12,6 +12,9 @@ add_mlir_dialect_library(MLIROpenMPDialect
MLIROpenMPOpsInterfacesIncGen
MLIROpenMPTypeInterfacesIncGen
+ LINK_COMPONENTS
+ TargetParser
+
LINK_LIBS PUBLIC
MLIRIR
MLIRLLVMDialect
More information about the Mlir-commits
mailing list