-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][runtime] Make sure to link libexecinfo if it exists #125344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl libc with libexecinfo.
@llvm/pr-subscribers-flang-runtime Author: Brad Smith (brad0) ChangesFixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl Full diff: https://github.com/llvm/llvm-project/pull/125344.diff 1 Files Affected:
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}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
If CMake knows to link to |
I'm definitely not an expert in this area but wouldn't this be a dependency of the runtime library so when the runtime library is loaded this would be too? Then flang just needs to know to link the runtime library |
If it is a static library, then no. There is no mechanism for transitive dependencies in |
) Fixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl libc with libexecinfo. (cherry picked from commit cb2598d)
#125998 does |
Fixes building the backtrace support on FreeBSD/NetBSD/OpenBSD/DragonFly and musl
libc with libexecinfo.