diff options
| author | Sergej Jaskiewicz <jaskiewiczs@icloud.com> | 2019-11-05 14:47:24 +0300 |
|---|---|---|
| committer | Sergej Jaskiewicz <jaskiewiczs@icloud.com> | 2019-12-04 00:52:19 +0300 |
| commit | b3fdf33ba6aa7ef80621696f74aaf2f6f8e1d1de (patch) | |
| tree | 9d382af364f1511e95368df8a46fc7e27a923671 /libunwind/test | |
| parent | 195eb9034af3d5352f8f5aa4b2156eb8579e8514 (diff) | |
| download | bcm5719-llvm-b3fdf33ba6aa7ef80621696f74aaf2f6f8e1d1de.tar.gz bcm5719-llvm-b3fdf33ba6aa7ef80621696f74aaf2f6f8e1d1de.zip | |
Enable `-funwind-tables` flag when building libunwind
Summary:
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).
Reviewers: peter.smith, phosek, EricWF, compnerd, jroelofs, saugustine, miyuki, jfb
Subscribers: mgorny, kristof.beyls, christof, libcxx-commits, miyuki
Tags: #libc
Differential Revision: https://reviews.llvm.org/D70815
Diffstat (limited to 'libunwind/test')
| -rw-r--r-- | libunwind/test/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | libunwind/test/libunwind/test/config.py | 10 | ||||
| -rw-r--r-- | libunwind/test/lit.site.cfg.in | 1 | ||||
| -rw-r--r-- | libunwind/test/signal_frame.pass.cpp | 4 |
4 files changed, 14 insertions, 2 deletions
diff --git a/libunwind/test/CMakeLists.txt b/libunwind/test/CMakeLists.txt index d902e3e8294..40d4acd4e8c 100644 --- a/libunwind/test/CMakeLists.txt +++ b/libunwind/test/CMakeLists.txt @@ -16,6 +16,7 @@ pythonize_bool(LIBCXX_ENABLE_SHARED) pythonize_bool(LIBUNWIND_ENABLE_SHARED) pythonize_bool(LIBUNWIND_ENABLE_THREADS) pythonize_bool(LIBUNWIND_ENABLE_EXCEPTIONS) +pythonize_bool(LIBUNWIND_USES_ARM_EHABI) pythonize_bool(LIBUNWIND_USE_COMPILER_RT) pythonize_bool(LIBUNWIND_BUILD_EXTERNAL_THREAD_LIBRARY) set(LIBUNWIND_TARGET_INFO "libcxx.test.target_info.LocalTI" CACHE STRING diff --git a/libunwind/test/libunwind/test/config.py b/libunwind/test/libunwind/test/config.py index 05e3f3cc21f..41ca3f9b4a4 100644 --- a/libunwind/test/libunwind/test/config.py +++ b/libunwind/test/libunwind/test/config.py @@ -37,6 +37,8 @@ class Configuration(LibcxxConfiguration): super(Configuration, self).configure_features() if not self.get_lit_bool('enable_exceptions', True): self.config.available_features.add('libcxxabi-no-exceptions') + if self.get_lit_bool('arm_ehabi', False): + self.config.available_features.add('libunwind-arm-ehabi') def configure_compile_flags(self): self.cxx.compile_flags += ['-DLIBUNWIND_NO_TIMER'] @@ -66,3 +68,11 @@ class Configuration(LibcxxConfiguration): def configure_compile_flags_rtti(self): pass + + def configure_link_flags_cxx_library(self): + # libunwind tests should not link with libc++ + pass + + def configure_link_flags_abi_library(self): + # libunwind tests should not link with libc++abi + pass diff --git a/libunwind/test/lit.site.cfg.in b/libunwind/test/lit.site.cfg.in index 34da72ac106..37f90a90efd 100644 --- a/libunwind/test/lit.site.cfg.in +++ b/libunwind/test/lit.site.cfg.in @@ -19,6 +19,7 @@ config.executor = "@LIBUNWIND_EXECUTOR@" config.libunwind_shared = @LIBUNWIND_ENABLE_SHARED@ config.enable_shared = @LIBCXX_ENABLE_SHARED@ config.enable_exceptions = @LIBUNWIND_ENABLE_EXCEPTIONS@ +config.arm_ehabi = @LIBUNWIND_USES_ARM_EHABI@ config.host_triple = "@LLVM_HOST_TRIPLE@" config.target_triple = "@TARGET_TRIPLE@" config.use_target = bool("@LIBUNWIND_TARGET_TRIPLE@") diff --git a/libunwind/test/signal_frame.pass.cpp b/libunwind/test/signal_frame.pass.cpp index a6f3f483bea..a899461fafb 100644 --- a/libunwind/test/signal_frame.pass.cpp +++ b/libunwind/test/signal_frame.pass.cpp @@ -9,6 +9,8 @@ // Ensure that functions marked as signal frames are reported as such. +// UNSUPPORTED: libunwind-arm-ehabi + #include <assert.h> #include <stdlib.h> #include <libunwind.h> @@ -20,9 +22,7 @@ void test() { unw_getcontext(&uc); unw_init_local(&cursor, &uc); assert(unw_step(&cursor) > 0); -#if !defined(_LIBUNWIND_ARM_EHABI) assert(unw_is_signal_frame(&cursor)); -#endif } int main() { |

