https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/125515
Backport cb2598dda1aae5096a77bc8a9f6679ca1b350e5e Requested by: @brad0 >From acd0c6c1774c2c2ba97c714709041f6561370447 Mon Sep 17 00:00:00 2001 From: Brad Smith <b...@comstyle.com> Date: Mon, 3 Feb 2025 10:03:59 -0500 Subject: [PATCH] [flang][runtime] Make sure to link libexecinfo if it exists (#125344) Fixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl libc with libexecinfo. (cherry picked from commit cb2598dda1aae5096a77bc8a9f6679ca1b350e5e) --- flang/runtime/CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index fbfaae9a880648..bf27a121e4d174 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -59,10 +59,15 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) ) endif() +set(linked_libraries FortranDecimal) + # function checks find_package(Backtrace) set(HAVE_BACKTRACE ${Backtrace_FOUND}) set(BACKTRACE_HEADER ${Backtrace_HEADER}) +if(HAVE_BACKTRACE) + list(APPEND linked_libraries ${Backtrace_LIBRARY}) +endif() include(CheckCXXSymbolExists) include(CheckCXXSourceCompiles) @@ -271,7 +276,7 @@ if (NOT DEFINED MSVC) add_flang_library(FortranRuntime ${sources} LINK_LIBS - FortranDecimal + ${linked_libraries} INSTALL_WITH_TOOLCHAIN ) @@ -279,7 +284,7 @@ else() add_flang_library(FortranRuntime ${sources} LINK_LIBS - FortranDecimal + ${linked_libraries} ) set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) add_flang_library(FortranRuntime.static ${sources} _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits