This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Enforce LLVM_ENABLE_UNWIND_TABLES
ClosedPublic

Authored by luismarques on Feb 16 2023, 2:54 AM.

Details

Summary

In 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)

Diff Detail

Event Timeline

luismarques created this revision.Feb 16 2023, 2:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 2:54 AM
luismarques requested review of this revision.Feb 16 2023, 2:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2023, 2:54 AM
compnerd accepted this revision.Feb 16 2023, 7:35 AM

We do have other examples of ternary state options., and making this ternary for the sake of compatibility is an intriguing idea. However, I also ascribe to POLA/POLS. Mapping LLVM_ENABLE_UNWIND_TABLES to -funwind-tables seems pretty reasonable to me. The only time that you would want to disable these is if it is an embedded context where you do not care about debugging or crash analytics, where you should pretty quickly see the size impact. If this plays out to be a problem to be enabled by default we can always revisit the ternary state.

This revision is now accepted and ready to land.Feb 16 2023, 7:35 AM
This revision was automatically updated to reflect the committed changes.