[llvm] [offload] Fix finding libomptarget in runtimes build (PR #157856)

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 06:28:39 PDT 2025


https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/157856

Per the logic in top-level CMakeLists, `libomptarget` is placed into `LLVM_LIBRARY_OUTPUT_INTDIR` when this variable is set.  Adjust the test logic to include this directory in `-L` and `-Wl,-rpath` arguments as well, in order to fix finding tests when building via the `runtimes` top-level directory.

>From 3b9a03cddb789c71e8d9eb9df809a6cdb9d654d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Wed, 10 Sep 2025 15:26:01 +0200
Subject: [PATCH] [offload] Fix finding libomptarget in runtimes build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Per the logic in top-level CMakeLists, `libomptarget` is placed
into `LLVM_LIBRARY_OUTPUT_INTDIR` when this variable is set.  Adjust
the test logic to include this directory in `-L` and `-Wl,-rpath`
arguments as well, in order to fix finding tests when building
via the `runtimes` top-level directory.

Signed-off-by: Michał Górny <mgorny at gentoo.org>
---
 offload/test/lit.cfg | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/offload/test/lit.cfg b/offload/test/lit.cfg
index a41bcb9c0d064..c0290bfdab3ff 100644
--- a/offload/test/lit.cfg
+++ b/offload/test/lit.cfg
@@ -83,6 +83,7 @@ config.test_format = lit.formats.ShTest()
 config.test_flags = " -I " + config.test_source_root + \
     " -I " + config.omp_header_directory + \
     " -L " + config.library_dir + \
+    " -L " + config.llvm_library_intdir + \
     " -L " + config.llvm_lib_directory
 
 # compiler specific flags
@@ -165,6 +166,7 @@ else: # Unices
         config.test_flags += " -nogpulib"
     config.test_flags += " -Wl,-rpath," + config.library_dir
     config.test_flags += " -Wl,-rpath," + config.omp_host_rtl_directory
+    config.test_flags += " -Wl,-rpath," + config.llvm_library_intdir
     config.test_flags += " -Wl,-rpath," + config.llvm_lib_directory
     if config.cuda_libdir:
         config.test_flags += " -Wl,-rpath," + config.cuda_libdir



More information about the llvm-commits mailing list