[Mlir-commits] [mlir] [mlir-cpu-runner] Pass --exclude-libs to linker when building runner (PR #122329)

Andrea Faulds llvmlistbot at llvm.org
Thu Jan 9 10:21:33 PST 2025


https://github.com/andfau-amd created https://github.com/llvm/llvm-project/pull/122329

This fixes a conflict between the version of LLVM linked against by the runner and the unrelated version of LLVM that may be dynamically loaded by a graphics driver. (Relevant to #73457: fixes loading certain Vulkan drivers.)

>From e3e57162cb5bef9202b58283792ea34dadd80aa5 Mon Sep 17 00:00:00 2001
From: Andrea Faulds <andrea.faulds at amd.com>
Date: Thu, 9 Jan 2025 19:20:27 +0100
Subject: [PATCH] [mlir-cpu-runner] Pass --exclude-libs to linker when building
 runner

This fixes a conflict between the version of LLVM linked against by the
runner and the unrelated version of LLVM that may be dynamically loaded
by a graphics driver. (Relevant to #73457: fixes loading certain Vulkan
drivers.)
---
 mlir/tools/mlir-cpu-runner/CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mlir/tools/mlir-cpu-runner/CMakeLists.txt b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
index 811583b97bc71d..f6ed2ed414647c 100644
--- a/mlir/tools/mlir-cpu-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-cpu-runner/CMakeLists.txt
@@ -26,3 +26,10 @@ target_link_libraries(mlir-cpu-runner PRIVATE
   MLIRExecutionEngine
   MLIRJitRunner
   )
+target_link_options(mlir-cpu-runner
+  PRIVATE
+    # On Linux, disable re-export of any static linked libraries that came
+    # through. This prevents our LLVM build from interfering with the version of
+    # LLVM included in certain graphics drivers.
+    $<$<PLATFORM_ID:Linux>:LINKER:--exclude-libs,ALL>
+)



More information about the Mlir-commits mailing list