summaryrefslogtreecommitdiffstats
path: root/libunwind/test
Commit message (Collapse)AuthorAgeFilesLines
* Reland "Enable `-funwind-tables` flag when building libunwind"Sergej Jaskiewicz2019-12-114-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Relands https://reviews.llvm.org/D70815. The original commit set `CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC_LIBRARY` globally in libunwind/CMakeLists.txt, which effectively disabled the linking step in CMake checks. This broke some builds (see 938c70b86c7d2165f8c28d5700e9c1ac1263307e). Here we set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY only when checking for presence of the `-funwind-tables` flag, and then set it back to the original value so it doesn't affect other checks. Reviewers: mstorsjo, jfb Subscribers: mgorny, christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D71117
* Revert "Enable `-funwind-tables` flag when building libunwind"Martin Storsjö2019-12-044-14/+2
| | | | | | | | | | | | | | | | | This reverts commit b3fdf33ba6aa7ef80621696f74aaf2f6f8e1d1de. This change broke building libunwind for Windows/MinGW, and broke on aspect of the CMake tests in libunwind in general. After set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY), CMake skips the linking step in tests, but cmake/config-ix.cmake also does a few checks for functions in libraries (looking for whether -lc provides fopen and whether -ldl provides dladdr). As CMake only tests building a static library, these tests incorrectly succeed and CMake concludes "Looking for fopen in c - found" and "Looking for dladdr in dl - found", while building then fails at the end with errors about unable to find -lc and -ldl.
* Enable `-funwind-tables` flag when building libunwindSergej Jaskiewicz2019-12-044-2/+14
| | | | | | | | | | | | | | | | | | | | | 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
* [libunwind] Adjust the signal_frame test for ArmMikhail Maltsev2019-11-191-1/+7
| | | | | | | | | | | | | | | | | | | | Summary: This patch adjusts the signal_frame.pass.cpp to pass on Arm targets: * When Arm EHABI is used the unwinder does not use DWARF, hence the DWARF-specific check unw_is_signal_frame() must be disabled. * Certain C libraries don't include EH tables, so the unwinder must not try to step out of main(). The patch moves the test code out of main() into a separate function to avoid this. Reviewers: saugustine, ostannard, phosek, jfb, mclow.lists Reviewed By: saugustine Subscribers: dexonsmith, aprantl, kristof.beyls, christof, libcxx-commits, pbarrio, labrinea Tags: #libc Differential Revision: https://reviews.llvm.org/D70397
* Correctly update isSignalFrame when unwinding the stack via dwarf.Sterling Augustine2019-11-071-0/+25
| | | | | | | | | | | | | | | | | | A "signal frame" is a function or block of code where execution arrives via a signal or interrupt, rather than via a normal call instruction. In fact, a particular instruction is interrupted by the signal and needs to be restarted. Therefore, when the signal handler is complete, execution needs to return to the interrupted instruction, rather than the instruction immediately following the call instruction, as in a normal call. Stack unwinders need to know this to correctly unwind signal frames. Dwarf handily provides an "S" in the CIE augmentation string to describe this case, and the libunwind API provides various functions to for unwinders to determine it,. The llvm libunwind implementation correctly sets it's internal variable "isSignalFrame" when initializing an unwind context. However, upon stepping up the stack, the current implementation correctly reads the augmentation string and sets it in the CIE info (which it then discards), libunwind doesn't update it's internal unwind context data structure. This change fixes that, and provides compatibility with both the canonical libunwind and the libgcc implementation. Reviewers: jfb Subscribers: christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D69677
* [libunwind] Adjust libunwind_01.pass.cpp test for ARM EHABIJohn Brawn2019-10-031-1/+1
| | | | | | | | | | | | ARM EHABI unwinding tables only store the start address of each function, so the last function is assumed to cover the entire address space after it. The test picks an address on the stack assuming that it's in no function, but because of the above it's actually resolved to the last function. Fix this by using address 0 instead. Differential Revision: https://reviews.llvm.org/D68387 llvm-svn: 373628
* Unwind: prevent unw_get_proc_info from returning stale dataSaleem Abdulrasool2019-09-201-0/+21
| | | | | | | | | | | | If unwind info is not available at the current IP, unw_get_proc_info should return a zero-filled structure rather than the info of the previous IP. This change also makes unw_get_proc_info return UNW_ENOINFO instead of UNW_ESUCCESS. Patch by Amanieu d'Antras! llvm-svn: 372407
* [libunwind] [test] Fix inferring source pathsMichal Gorny2019-05-291-6/+4
| | | | | | | | | | | | | | | | | | | | | | Fix two issues that caused libcxx source path not to be inferred correctly when not specified explicitly: 1. get_lit_conf() uses default value only if the lit variable is set to None. Due to the mehod of substituting lit.site.cfg, they were "" rather than None when unset, effectively causing the default never to apply. Instead, use 'or' construct to use the default whenever get_lit_conf() returns a false value. 2. If os.path.join() is given a component starting with '/', it takes it to be an absolute path and ignores everything preceding it. Remove the slash to correctly append subdirectory. With these two fixes, libunwind tests start working on NetBSD buildbot again. Differential Revision: https://reviews.llvm.org/D62005 llvm-svn: 361931
* [PPC64][libunwind] Fix r2 not properly restoredMartin Storsjo2019-05-161-0/+3
| | | | | | | | | | | | | | | | This change makes each unwind step inspect the instruction at the return address and, if needed, read r2 from its saved location and modify the context appropriately. The unwind logic is able to handle both ELFv1 and ELFv2 stacks. Reported by Bug 41050 Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D59694 llvm-svn: 360861
* [CMake] Support compiler-rt builtins library in testsPetr Hosek2019-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | We're building tests with -nostdlib which means that we need to explicitly include the builtins library. When using libgcc (default) we can simply include -lgcc_s on the link line, but when using compiler-rt builtins we need a complete path to the builtins library. This path is already available in CMake as <PROJECT>_BUILTINS_LIBRARY, so we just need to pass that path to lit and if config.compiler_rt is true, link it to the test. Prior to this patch, running tests when compiler-rt is being used as the builtins library was broken as all tests would fail to link, but with this change running tests when compiler-rt bultins library is being used should be supported. Differential Revision: https://reviews.llvm.org/D56701 llvm-svn: 353208
* [CMake] Update lit test configurationPetr Hosek2019-02-052-7/+9
| | | | | | | | | There are several changes: - Don't stringify Pythonized bools (that's why we're Pythonizing them) - Support specifying target and sysroot via CMake variables - Use consistent spelling for --target, --sysroot, --gcc-toolchain llvm-svn: 353137
* [CMake] Support CMake variables for setting target, sysroot and toolchainPetr Hosek2019-02-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | CMake has a standard way of setting target triple, sysroot and external toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into corresponding --target=, --sysroot= and --gcc-toolchain= variables add included appended to CMAKE_<LANG>_FLAGS. libunwind, libc++abi, libc++ provides their own mechanism through <PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN variables. These are also passed to lit via lit.site.cfg, and lit config uses these to set the corresponding compiler flags when building tessts. This means that there are two different ways of setting target, sysroot and toolchain, but only one is properly supported in lit. This change extends CMake build for libunwind, libc++abi and libc++ to also support the CMake variables in addition to project specific ones in lit. Differential Revision: https://reviews.llvm.org/D57670 llvm-svn: 353084
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-192-8/+6
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [libunwind] Permit additional compiler and linker flags to be passed to tests.John Baldwin2018-02-271-0/+2
| | | | | | | | | | | | Summary: This is done via new LIBUNWIND_TEST_COMPILER_FLAGS and LIBUNWIND_TEST_LINKER_FLAGS variables. Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D43585 llvm-svn: 326223
* [libunwind] Pass LIBUNWIND_SYSROOT and LIBUNWIND_GCC_TOOLCHAIN to litPetr Hosek2017-12-051-0/+2
| | | | | | | | | These are expected to be set by the shared lit scripts used from libc++. Differential Revision: https://reviews.llvm.org/D40817 llvm-svn: 319823
* [libunwind] Always use unwind tables in testsPeter Smith2017-10-261-3/+4
| | | | | | | | | | | | | | | For many targets setting -fno-exceptions will prevent unwinding tables from being generated for the test programs. As libunwind depends on the tables to unwind the stack several tests will fail. This change always adds -funwind-tables so that even when -fno-exceptions is set unwind tables are generated. fixes PR33858 Differential Revision: https://reviews.llvm.org/D37484 llvm-svn: 316657
* ARM: explicitly specify the 8-byte alignmentSaleem Abdulrasool2017-08-231-2/+10
| | | | | | | | | It seems that GCC interprets `__attribute__((__aligned__))` as 8-byte alignment on ARM, but clang does not. Explicitly specify the double-word alignment value to ensure that the structure is properly aligned. llvm-svn: 311574
* Partial fix for PR33858Jonathan Roelofs2017-07-262-2/+1
| | | | | | https://reviews.llvm.org/D35848 llvm-svn: 309147
* Add a test harnessJonathan Roelofs2017-07-067-0/+198
| | | | | | | | | | Mostly cargo-culted from libcxxabi, since the unwinder was forked from there in the first place. There may still be cruft that's only applicable to libcxxabi, but that can be addressed in-tree. https://reviews.llvm.org/D35038 llvm-svn: 307266
* [libunwind] Properly align _Unwind_Exception.Eric Fiselier2016-07-201-0/+21
| | | | | | | | | | | | Summary: _Unwind_Exception is required to be double word aligned. Currently the struct is under aligned. Reviewers: mclow.lists, compnerd, kledzik, emaste Subscribers: emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D22543 llvm-svn: 276215
* Fix unw_getcontext() return value on AArch64.Logan Chien2015-06-251-0/+8
| | | | | | | | unw_getcontext() should return UNW_ESUCCESS on success. Therefore, the assembly for AArch64 is incorrect because "ldr x0, #0" is a PC-relative load instead of an immediate value load. llvm-svn: 240648
* libunwind: Fix unw_step() for ARM EHABI.Logan Chien2015-05-292-0/+79
| | | | | | | | | | | | | | | | | | | This commit fixes the unw_step() for ARM EHABI. However, this commit also changes the implementation details for ARM EHABI. The first change is that the personality function should call __gnu_unwind_frame() for default (or de facto) frame unwinding based on the ARM-defined unwind opcode. The function __gnu_unwind_frame() will in turn calls unw_step() which actually unwinds the frame. The second change is that the implementation _Unwind_Backtrace() should no longer calls unw_step() to unwind the frame; since according to ARM EHABI, the personality function should unwind the frame for us. Special thanks to Anton for helpful suggestion on the initial version of this patch. llvm-svn: 238560
* unwind: remove libc++abi testsSaleem Abdulrasool2015-04-246-771/+0
| | | | | | | These are related to libc++abi's personality routine and not core unwinding. These have been restored in libc++abi, and are no longer needed here. llvm-svn: 235766
* unwind: move src/Unwind, include/, and test/ unwind contentSaleem Abdulrasool2015-04-246-0/+771
This moves the majority of the unwind sources into the new project layout for libunwind. This was previously discussed on llvmdev at [1]. This is a purely movement related change, with the build infrastructure currently still residing in the libc++abi repository. [1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-January/081507.html llvm-svn: 235758
OpenPOWER on IntegriCloud