[llvm] [flang-rt] Fix NVPTX builds erroneously using backtrace support (PR #184415)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 10:55:43 PST 2026


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/184415

Summary:
This is caused  by the CMake hacks I had to do to worm around NVIDIA's
proprietary binaries.


>From e63d7f4f049c595a47c8b94fde91d28195e84182 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 3 Mar 2026 12:53:43 -0600
Subject: [PATCH] [flang-rt] Fix NVPTX builds erroneously using backtrace
 support

Summary:
This is caused  by the CMake hacks I had to do to worm around NVIDIA's
proprietary binaries.
---
 flang-rt/CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/flang-rt/CMakeLists.txt b/flang-rt/CMakeLists.txt
index 899d03c671869..d7a554b5e94d3 100644
--- a/flang-rt/CMakeLists.txt
+++ b/flang-rt/CMakeLists.txt
@@ -283,11 +283,15 @@ endif()
 find_package(Threads)
 
 # function checks
-find_package(Backtrace)
+# FIXME: The NVPTX target will erroneously report it has backtrace support. This
+#        is caused by using "-c -flto" in the required flags to suppress CUDA
+#        tools from being required for the CMake flag checks to succeed.
+if ("${LLVM_RUNTIMES_TARGET}" MATCHES "^nvptx")
+  find_package(Backtrace)
+endif()
 set(HAVE_BACKTRACE ${Backtrace_FOUND})
 set(BACKTRACE_HEADER ${Backtrace_HEADER})
 
-
 #####################
 # Build Preparation #
 #####################



More information about the llvm-commits mailing list