[libcxx-commits] [PATCH] D70815: Enable `-funwind-tables` flag when building libunwind

Sergej Jaskiewicz via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 28 05:12:45 PST 2019


broadwaylamb created this revision.
broadwaylamb added reviewers: peter.smith, phosek, EricWF, compnerd, jroelofs, saugustine, miyuki.
Herald added subscribers: libcxx-commits, christof, kristof.beyls, mgorny.
Herald added a reviewer: jfb.
Herald added a project: libc++.

Or, rather, don't accidentally forget to pass it.

This is aimed to solve the problem discussed in this thread <http://lists.llvm.org/pipermail/llvm-dev/2019-November/136890.html>, and to fix a year-old bug <https://bugs.llvm.org/show_bug.cgi?id=38468>.

TL;DR: when building libunwind for ARM Linux, we **need** libunwind to be built with the `-funwind-tables` flag, because, well ARM EHABI needs unwind info produced by this flag. Without the flag all the procedures in libunwind are marked `.cantunwind`, which causes all sorts of bad things. From `_Unwind_Backtrace` not working, to C++ exceptions not being caught (which is the aforementioned bug is about).

Previously, this flag was not added because the CMake check `add_compile_flags_if_supported(-funwind-tables)` produced a false negative. Why? With this flag, the compiler generates calls to the `__aeabi_unwind_cpp_pr0` symbol, which is defined in libunwind itself and obviously is not available at configure time, before libunwind is built. This led to failure at link time during the CMake check. We handle this by disabling the linker for CMake checks in linbunwind.

Also, this patch introduces a lit feature `libunwind-arm-ehabi`, which is used to mark the `signal_frame.pass.cpp` test as unsupported (as was advised by @miyuki in D70397 <https://reviews.llvm.org/D70397>).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70815

Files:
  libunwind/CMakeLists.txt
  libunwind/cmake/config-ix.cmake
  libunwind/test/CMakeLists.txt
  libunwind/test/libunwind/test/config.py
  libunwind/test/lit.site.cfg.in
  libunwind/test/signal_frame.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70815.231413.patch
Type: text/x-patch
Size: 4994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191128/7cdadee6/attachment-0001.bin>


More information about the libcxx-commits mailing list