[llvm] [llvm][cmake] Try LLVM libunwind when frame registration is unavailable (PR #112087)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 3 19:35:39 PST 2024


================
@@ -272,6 +272,13 @@ endif()
 check_symbol_exists(__register_frame "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_REGISTER_FRAME)
 check_symbol_exists(__deregister_frame "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_DEREGISTER_FRAME)
 check_symbol_exists(__unw_add_dynamic_fde "${CMAKE_CURRENT_LIST_DIR}/unwind.h" HAVE_UNW_ADD_DYNAMIC_FDE)
+if (NOT (HAVE_REGISTER_FRAME OR HAVE_DEREGISTER_FRAME OR HAVE_UNW_ADD_DYNAMIC_FDE))
+  check_library_exists(unwind __unw_add_dynamic_fde "" HAVE_LLVM_LIBUNWIND)
+  if (HAVE_LLVM_LIBUNWIND)
+    list(APPEND CMAKE_REQUIRED_LIBRARIES "unwind")
+    set(HAVE_UNW_ADD_DYNAMIC_FDE 1)
+  endif ()
+endif ()
----------------
ziyao233 wrote:

> What is your minimum libunwind version?

We're shipping LLVM 18.

> We should probably change what the JIT uses instead -- there are better options than `__unw_add_dynamic_fde` these days.

I'm glad to see a better solution that doesn't depend on unwinder-specific behaviour/routine.

https://github.com/llvm/llvm-project/pull/112087


More information about the llvm-commits mailing list