summaryrefslogtreecommitdiffstats
path: root/libunwind
Commit message (Collapse)AuthorAgeFilesLines
...
* There is no portable format string for printing `uintptr_t` values.Chandler Carruth2017-12-271-6/+6
| | | | | | | | | Instead, cast them to `void *` which has a portable format string syntax of `%p`. This fixes a -Wformat error when building libunwind. llvm-svn: 321469
* [libunwind] Remove dubious template function. NFC.whitequark2017-12-251-7/+3
| | | | | | Per review by Don Hinton. llvm-svn: 321448
* [libunwind] Unbreak debug builds after r321440.whitequark2017-12-251-4/+7
| | | | llvm-svn: 321446
* [libunwind] Add proper support for DWARF unwind on bare metal.whitequark2017-12-251-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, ARM EHABI unwind on bare metal expects to find the symbols __exidx_start and __exidx_end defined, and uses those to locate the EH tables. However, DWARF unwind on bare metal expects to find dl_iterate_phdr, which, although possible to provide, is inconvenient and mildly absurd. This commit provides feature parity with ARM EHABI unwind by looking for symbols __eh_frame_start, __eh_frame_end, __eh_frame_hdr_start and __eh_frame_hdr_end, denoting the start and end of the sections with corresponding names. As far as I know, there is no de jure or de facto ABI providing any such names, so I chose the obvious ones. The .eh_frame_hdr support is optional for maximum flexibility and possible space savings (e.g. if libunwind is only used to provide backtraces when a device crashes, providing the .eh_frame_hdr, which is an index for rapid access to EH tables, would be a waste.) The support for .eh_frame_hdr/DWARF index in the first place is conditional on defined(_LIBUNWIND_SUPPORT_DWARF_INDEX), although right now config.h will always define this macro. The support for DWARF unwind on bare metal has been validated within the ARTIQ environment[1]. [1]: https://m-labs.hk/artiq/ llvm-svn: 321445
* [libunwind] fix a typo in r321441.whitequark2017-12-251-1/+1
| | | | llvm-svn: 321442
* [libunwind] convert error logs to _LIBUNWIND_LOG/_LIBUNWIND_LOG0.whitequark2017-12-252-35/+35
| | | | | | | | | | | | | Use the `_LIBUNWIND_LOG` and `_LIBUNWIND_LOG0` macros instead of the explicit `fprintf` call. This was previously done in r292721 as a cleanup and then reverted in r293257 because the implementation in r292721 relied on a GNU extension. This implementation avoids the use of an extension by using a second macro instead, and allows to avoid the dependency on fprintf if _LIBUNWIND_BARE_METAL is defined. llvm-svn: 321441
* [libunwind] Avoid using C++ headers.whitequark2017-12-251-1/+1
| | | | | | This is useful for building libunwind on libcxx-free systems. llvm-svn: 321440
* [libunwind][MIPS]: Add support for unwinding in O32 and N64 processes.John Baldwin2017-12-128-2/+732
| | | | | | | | | | | This supports the soft-float ABI only and has been tested with both clang and gcc on FreeBSD. Reviewed By: sdardis, compnerd Differential Revision: https://reviews.llvm.org/D38110 llvm-svn: 320528
* [libunwind] Create install-unwind-stripped target manuallyShoaib Meenai2017-12-081-3/+11
| | | | | | | This supports using a newer libunwind with an older installation of LLVM (whose cmake modules wouldn't have add_llvm_install_targets). llvm-svn: 320163
* [libunwind][CMake] Set TARGET_TRIPLE if LIBUNWND_TARGET_TRIPLE is setPetr Hosek2017-12-051-0/+4
| | | | | | | | | This follows the setup used by other runtimes and is expected by the lit configuration. Differential Revision: https://reviews.llvm.org/D40820 llvm-svn: 319830
* [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] Switch to add_llvm_install_targetsShoaib Meenai2017-11-301-5/+3
| | | | | | | | | This gains us the install-unwind-stripped target, to perform stripping during installation. Differential Revision: https://reviews.llvm.org/D40685 llvm-svn: 319498
* Support building libunwind as a DLLMartin Storsjo2017-11-292-3/+12
| | | | | | Differential Revision: https://reviews.llvm.org/D40483 llvm-svn: 319300
* [CMake] Use the variable from the right project in install-unwindMartin Storsjo2017-11-291-1/+1
| | | | llvm-svn: 319299
* [libunwind][CMake] Provide option to disable instalation of the libraryPetr Hosek2017-11-172-3/+13
| | | | | | | | | | | | | | This is useful in cases where we only build static library and libunwind.a is combined with libc++abi.a into a single archive in which case we don't want to have libunwind.a installed separately. The same option is already provided by libcxx CMake build. This change also adds the install-unwind target for consistency with the libcxxabi and libcxx CMake build. Differential Revision: https://reviews.llvm.org/D40195 llvm-svn: 318569
* Remove a FIXME about truncated section namesMartin Storsjo2017-11-161-2/+0
| | | | | | | | | | | | | | | | | If the linker chose to store the full section name instead of truncating it, this field doesn't contain a truncated name, but an offset into the string table of the binary. The string table isn't loaded/mapped into memory during runtime though, so it's not possible to read the full section name, unless we try to locate the DLL/EXE on disk that the HMODULE corresponds to and load that manually. Due to this, lld now always prefers writing a truncated section name for sections that will be mapped at runtime, even when debug info is enabled. Differential Revision: https://reviews.llvm.org/D39918 llvm-svn: 318446
* [docs] Mention that dwarf unwinding should be supported on arm64/windowsMartin Storsjo2017-11-161-13/+13
| | | | | | | | | This didn't require any further changes to libunwind as long as win64 in general is handled correctly. Differential Revision: https://reviews.llvm.org/D39632 llvm-svn: 318383
* Add ifdefs around ELF specific parts of UnwindRegisters*.S for armMartin Storsjo2017-11-043-1/+21
| | | | | | | | This allows using dwarf exceptions on MinGW/ARM. Differential Revision: https://reviews.llvm.org/D39534 llvm-svn: 317423
* Fix building for ARM with dwarf exception handlingMartin Storsjo2017-11-025-8/+15
| | | | | | | | | | | | | | | | The previous definition of _LIBUNWIND_HIGHEST_DWARF_REGISTER seems to be a copy of the ARM64 value (introduced in SVN r276128); since the code actually hasn't compiled properly for arm in dwarf mode before, this hasn't actually been used. Set it to the correct value based on the UNW_ARM_* enum values. The iwmmx control variables have to be made mutable, since they are touched from within getRegister (which previously wasn't const), and getRegister is used on a const Registers object in DwarfInstructions.hpp. Differential Revision: https://reviews.llvm.org/D39251 llvm-svn: 317192
* [libunwind] Don't use dl_iterate_phdr if __ANDROID_API__ < 21Dan Albert2017-11-011-0/+8
| | | | | | | | | | | | | | | | Summary: On ARM, dl_iterate_phdr is only implemented in the Android NDK version 21 or later: https://android.googlesource.com/platform/prebuilts/ndk/+/dev/platform/sysroot/usr/include/link.h#55 Reviewers: thakis, danalbert Reviewed By: danalbert Subscribers: dtzWill, aemerson, srhines, kristof.beyls Differential Revision: https://reviews.llvm.org/D39468 llvm-svn: 317125
* Change unw_word_t to always have the same size as the pointer sizeMartin Storsjo2017-10-306-40/+40
| | | | | | | | | | | | | This matches the original libunwind API. This also unifies the type between ARM EHABI and the other configurations, and allows getting rid of a number of casts in log messages. The cursor size updates for ppc and or1k are untested, but unw_proc_info_t shrinks by 4 uint64_t units on i386 at least. Differential Revision: https://reviews.llvm.org/D39365 llvm-svn: 316942
* Restore arch specific lastDwarfRegNum in builds without ↵Martin Storsjo2017-10-282-12/+18
| | | | | | | | | | | _LIBUNWIND_IS_NATIVE_ONLY This restores the previous behaviour of the Registers_* classes after SVN r316745. Differential Revision: https://reviews.llvm.org/D39382 llvm-svn: 316843
* Add support for dwarf unwinding on windows on x86_64Martin Storsjo2017-10-279-37/+171
| | | | | | | | | | | | | | | Clang doesn't currently support building for windows/x86_64 with dwarf by setting command line parameters, but if manually modified to use dwarf, we can make libunwind work in this configuration as well. Also include i386 in the docs when adding this as a supported configuration; libunwind already works for i386 windows, but can fail due to an issue unrelated to windows itself. Differential Revision: https://reviews.llvm.org/D38819 llvm-svn: 316747
* Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTERMartin Storsjo2017-10-274-14/+14
| | | | | | | | | | | | | | This avoids having to keep the same information duplicated in multiple places. Adjust _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value of the highest used register and only use the value _LIBUNWIND_HIGHEST_DWARF_REGISTER + 1 (kMaxRegisterNumber + 1) for allocating the savedRegisters array. Differential Revision: https://reviews.llvm.org/D39281 llvm-svn: 316745
* [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
* Fix the context/cursor size for ARM with WMMX enabledMartin Storsjo2017-10-251-2/+2
| | | | | | | | This was missed in SVN r274744 when the WMMX part was made optional; when made optional, some struct fields were reordered, which caused the total struct size to grow due to padding/alignment. llvm-svn: 316559
* Add missing checks for register numberMartin Storsjo2017-10-241-0/+19
| | | | | | | | | Most other cases that touch savedRegisters[reg] have got this check, but these three seemed to lack it. Differential Revision: https://reviews.llvm.org/D39206 llvm-svn: 316415
* Abstract rwlocks into a class, provide a SRW lock implementation for windowsMartin Storsjo2017-10-234-30/+97
| | | | | | | | | | | | | | This requires _WIN32_WINNT >= 0x0600. If someone wants to spend effort on supporting earlier versions, one can easily add another fallback implementation based on critical sections, or try to load SRW lock functions dynamically. This makes sure that the FDE cache is thread safe on windows. Differential Revision: https://reviews.llvm.org/D38704 llvm-svn: 316364
* Make HIDDEN_DIRECTIVE a function-like macro. NFCI.Martin Storsjo2017-10-221-16/+9
| | | | | | | | | | This avoids a hack for making it a no-op for windows. Also explicitly check for _WIN32 instead of assuming it. Differential Revision: https://reviews.llvm.org/D39156 llvm-svn: 316300
* GNU: do not read the FDE count if omittedSaleem Abdulrasool2017-10-201-1/+3
| | | | | | | | | If there is no binary search table computed, the FDECount encoding is DW_EH_PE_omit. Do not attempt to read the FDECount in such a situation as we will read an incorrect value. binutils only writes out the FDECount if the encoding is not DW_EH_PE_omit. llvm-svn: 316224
* libunwind: document tested FreeBSD configs and sort OS listEd Maste2017-10-141-4/+5
| | | | | | | | | | | | libunwind is known to work on FreeBSD i386, amd64 (x86_64) and arm64. It is the unwinder provided by the base system on all of those architectures. While here sort the OS list. Differential Revision: https://reviews.llvm.org/D38900 llvm-svn: 315814
* Support DWARF unwinding on i386 windowsMartin Storsjo2017-10-114-2/+59
| | | | | | | | | In practice, with code built with clang, there are still unresolved issues with DW_CFA_GNU_args_size though. Differential Revision: https://reviews.llvm.org/D38679 llvm-svn: 315498
* [docs] Mention that linux/arm64 is supported with DWARFMartin Storsjo2017-10-111-1/+1
| | | | llvm-svn: 315497
* [docs] Mention that SjLj works on any OS on the archs where supported by the ↵Martin Storsjo2017-10-061-0/+1
| | | | | | | | compiler Differential Revision: https://reviews.llvm.org/D38576 llvm-svn: 315090
* build: use POSITION_INDEPENDENT_CODE instead of -fPICSaleem Abdulrasool2017-10-032-3/+2
| | | | | | | | Rather than hardcode the flag and check if the compiler supports it, use the CMake property to get the right flag spelling for the compiler. This makes it generally more portable. llvm-svn: 314834
* Add CMake support for building for MinGWMartin Storsjo2017-10-021-0/+13
| | | | | | | | This section is similar to what already exists in libcxx and libcxxabi. Differential Revision: https://reviews.llvm.org/D38380 llvm-svn: 314716
* Fix building on macOS after SVN r314492Martin Storsjo2017-10-022-6/+6
| | | | | | | | That commit incorrectly expanded the assumption that defined(__APPLE__) implies SjLj exception handling, which only is true within ARM code sections. llvm-svn: 314695
* SjLj: Fix building after SVN r314632Martin Storsjo2017-10-011-1/+1
| | | | | | | The code moved from Unwind_AppleExtras.cpp to Unwind-sjlj.c needed a few minor modifications to build as C instead of C++. llvm-svn: 314635
* SjLj: make the SjLj implementation more portableSaleem Abdulrasool2017-10-014-81/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves the definition of the internal helpers `__Unwind_SjLj_GetTopOfFunctionStack` and `__Unwind_SjLj_SetTopOfFunctionStack` into `Unwind-sjlj.c`. These are not extra functions specific to Apple, but rather are internal implementation details of SjLj support in the LLVM libunwind implementation. This allows us to remove the internal header unwind_ext.h, as these functions are not meant to be used as SPI either. Because they are static, they will be given implicit hidden visibility, but due to the simplicity should get fully inlined into the actual use. Use the C11 standard static TLS annotation (`_Thread_local`) if possible, otherwise, use the Windows specific `__declspec(thread)` when targeting Windows or the GNU `__thread` extension. In theory, it should be possible for this implementation to use a `pthread_setspecific` and `pthread_getspecific` on platforms with pthreads or `SetFlsValue` and `GetFlsValue` on Windows for non-static TLS. However, static TLS tends to be significantly faster, so we really should prefer that over the dynamic TLS approach. On Apple environments, when not building for the loader (dyld), use the pre-allocated TLS slot in the loader rather than the local static TLS variable. Note that the un-threaded support of libunwind is still present as before, however, it is unsafe to use in a threaded environment as the cleanup stack may be mutated incorrectly due to lack of locking across threads. In the static TLS model, the lock is unneeded as each thread of execution retains its own copy of the cleanup stack. Take the opportunity to clean up the comment block, removing the iOS specific note as the SjLj implementation can be used outside of the context of iOS. Convert the rest of the explanation to a doxygen style comment block. llvm-svn: 314632
* Skip building x86 parts of UnwindRegisters*.S when targeting SjLjMartin Storsjo2017-09-292-2/+10
| | | | | | | | This extends SVN r314197 from the arm parts to the whole file. Differential Revision: https://reviews.llvm.org/D38381 llvm-svn: 314492
* Skip building unused parts when targeting SJLJMartin Storsjo2017-09-264-4/+6
| | | | | | | | | | | When SJLJ exceptions are used, those functions aren't used. This fixes build failures on ARM with SJLJ enabled (e.g. on armv7/iOS) when built using the CMake project files. Differential Revision: https://reviews.llvm.org/D38249 llvm-svn: 314197
* Correct data types in the _Unwind_FunctionContext structMartin Storsjo2017-09-261-2/+2
| | | | | | | | | This makes it match the definition used within llvm and in libgcc, we previously got the wrong layout in 64 bit environments. Differential Revision: https://reviews.llvm.org/D38247 llvm-svn: 314196
* [libunwind] Partially revert r297174 to fix build on at least FreeBSD.John Baldwin2017-09-211-69/+69
| | | | | | | | | | | | | | | The changes in r297174 moved the #include of <link.h> on FreeBSD (and probably other systems) inside of the open 'libunwind' namespace causing various system-provided types such as pid_t to be declared in this namespace rather than the global namespace. Fix this by moving the relevant declarations before the 'libunwind' namespace is opened, but still using the cleaned up declarations from r297174. Reviewed By: ed, compnerd Differential Revision: https://reviews.llvm.org/D38108 llvm-svn: 313920
* Fix a typo in the documentation. NFC.Martin Storsjo2017-09-161-1/+1
| | | | llvm-svn: 313470
* Revert r312240Alex Lorenz2017-08-312-4/+4
| | | | | | | The buildbots have shown that -Wstrict-prototypes behaves differently in GCC and Clang so we should keep it disabled until Clang follows GCC's behaviour llvm-svn: 312246
* Build LLVM with -Wstrict-prototypes enabledAlex Lorenz2017-08-312-4/+4
| | | | | | | | | | | Clang 5 supports -Wstrict-prototypes. We should use it to catch any C declarations that declare a non-prototype function. rdar://33705313 Differential Revision: https://reviews.llvm.org/D36669 llvm-svn: 312240
* ARM: explicitly specify the 8-byte alignmentSaleem Abdulrasool2017-08-232-3/+11
| | | | | | | | | 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
* unwind: explicitly align `_Unwind_Control_Block`Saleem Abdulrasool2017-08-231-1/+1
| | | | | | | | | | | | The C++ ABI requires that the exception object is double-word aligned. The alignment attribute was applied to the `_Unwind_Exception` type which is used on non-EHABI targets. On EHABI, the exception object type is `_Unwind_Control_Block`. Apply the explicit maximal alignment on the type to ensure that the allocation has the correct alignment. Resolves PR33858! llvm-svn: 311562
* [CMake] Allow overriding lib dir suffix independently from LLVMPetr Hosek2017-08-082-3/+5
| | | | | | | | This matches the options already supported by libc++ and libc++abi. Differential Revision: https://reviews.llvm.org/D36383 llvm-svn: 310327
* Partial fix for PR33858Jonathan Roelofs2017-07-262-2/+1
| | | | | | https://reviews.llvm.org/D35848 llvm-svn: 309147
OpenPOWER on IntegriCloud