[PATCH] D144178: [CMake] Enforce LLVM_ENABLE_UNWIND_TABLES

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 16 02:54:12 PST 2023


luismarques created this revision.
luismarques added reviewers: smeenai, compnerd, dblaikie.
Herald added a project: All.
luismarques requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In D61448 <https://reviews.llvm.org/D61448> the cmake option `LLVM_ENABLE_UNWIND_TABLES` was added. Despite the name suggesting that the option //enables// unwind tables, that patch only uses it to disable them. That makes a difference for architectures where unwind tables aren't enabled by default (assuming we compile with `-fno-exceptions`, which we typically do due to `LLVM_ENABLE_EH` defaulting to OFF). The lack of unwind tables impacts backtraces (for some architectures/configurations) and the current handling of the option doesn't allow enabling them.

This patch makes an ON value of `LLVM_ENABLE_UNWIND_TABLES` actually enable unwind tables.

With this change, perhaps we should also now make `LLVM_ENABLE_UNWIND_TABLES` be OFF by default. That preserves compatibility in some cases but introduces configuration changes in other cases. The only way to ensure full compatibility would be if we made this a ternary option (force on; default; force off).

(For context, this is part of a series of patches that I'm working on to fix/test backtraces)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144178

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -25,7 +25,9 @@
   else()
     if(LLVM_COMPILER_IS_GCC_COMPATIBLE)
       list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions")
-      if(NOT LLVM_ENABLE_UNWIND_TABLES)
+      if(LLVM_ENABLE_UNWIND_TABLES)
+        list(APPEND LLVM_COMPILE_FLAGS "-funwind-tables")
+      else()
         list(APPEND LLVM_COMPILE_FLAGS "-fno-unwind-tables")
         list(APPEND LLVM_COMPILE_FLAGS "-fno-asynchronous-unwind-tables")
       endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144178.497938.patch
Type: text/x-patch
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230216/c69ab9b7/attachment.bin>


More information about the llvm-commits mailing list