summaryrefslogtreecommitdiffstats
path: root/libunwind/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[libunwind] Drop the dependency on <algorithm>, add placement new ↵Petr Hosek2019-01-283-8/+5
| | | | | | | | | inline" This reverts commit r352384: this broke on ARM as UnwindCursor.hpp still has some C++ library dependencies. llvm-svn: 352427
* [libunwind] Drop the dependency on <algorithm>, add placement new inlinePetr Hosek2019-01-283-5/+8
| | | | | | | | | | | | We haven't eliminated C++ library dependency altogether in D57251, UnwindCursor.hpp had an unused dependency on <algorithm> which was pulling in other C++ headers. Removing that dependency also revealed (correctly) that we need our own global placement new declaration. Now libunwind should be independent of the C++ library. Differential Revision: https://reviews.llvm.org/D57262 llvm-svn: 352384
* [libunwind] Use placement new to avoid dependency C++ libraryPetr Hosek2019-01-251-7/+10
| | | | | | | | | | The rest of libunwind already uses placement new, these are the only places where non-placement new is being used introducing undesirable C++ library dependency. Differential Revision: https://reviews.llvm.org/D57251 llvm-svn: 352245
* [libunwind] Don't abort if encoutering invalid .eh_frame_hdrPetr Hosek2019-01-242-8/+14
| | | | | | | | | | | | | | | Recent Linux kernel release has introduced a bug as part of the ORC rollout where the vDSO has a valid .eh_frame section, but it's missing the .eh_frame_hdr section and GNU_EH_FRAME segment has zero size. This causes libunwind to abort which breaks programs that use libunwind. The other unwinder implementation (libgcc, non-gnu) instead silently bail out unless being compiled as debug. This change modifies libunwind to use the same strategy. Differential Revision: https://reviews.llvm.org/D57081 llvm-svn: 352016
* Silence warnings about unused parametersMartin Storsjo2019-01-223-0/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D56984 llvm-svn: 351888
* Remove an unused variableMartin Storsjo2019-01-221-1/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D56985 llvm-svn: 351878
* Add casts to avoid warnings about implicit conversions losing precisionMartin Storsjo2019-01-221-4/+3
| | | | | | | | | | | | | | | | | | | | This fixes warnings like these: DwarfInstructions.hpp:85:25: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'libunwind::DwarfInstructions<libunwind::LocalAddressSpace, libunwind::Registers_arm>::pint_t' (aka 'unsigned int') [-Wshorten-64-to-32] DwarfInstructions.hpp:88:25: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'libunwind::DwarfInstructions<libunwind::LocalAddressSpace, libunwind::Registers_arm>::pint_t' (aka 'unsigned int') [-Wshorten-64-to-32] Differential Revision: https://reviews.llvm.org/D56983 llvm-svn: 351877
* Fix warnings about printf format stringsMartin Storsjo2019-01-222-47/+63
| | | | | | | | | | Either adjust the format string to use a more exact type, or add casts (for cases when printing pointers to structs/objects with a %p format specifier). Differential Revision: https://reviews.llvm.org/D56982 llvm-svn: 351876
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1922-88/+66
| | | | | | | | | | | | | | | | | | 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
* [SjLj] Don't use __declspec(thread) in MinGW modeMartin Storsjo2019-01-181-1/+1
| | | | | | | | | | | GCC and Clang in MinGW mode don't support __declspec(thread), which after expanding macros ends up as __attribute__((thread)). Use the GCC specific attribute __thread instead (the next one in the chain of alternatives). Differential Revision: https://reviews.llvm.org/D56905 llvm-svn: 351587
* [Sparc] Add Sparc V8 supportDaniel Cederman2019-01-148-17/+333
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds the register class implementation for Sparc. Adds support for DW_CFA_GNU_window_save. Adds save and restore context functionality. Adds getArch() function to each Registers_ class to be able to separate between DW_CFA_AARCH64_negate_ra_state and DW_CFA_GNU_window_save which are both represented by the same constant. On Sparc the return address is the address of the call instruction, so an offset needs to be added when returning to skip the call instruction and its delay slot. If the function returns a struct it is also necessary to skip one extra instruction on Sparc V8. Reviewers: jyknight, mclow.lists, mstorsjo, compnerd Reviewed By: jyknight, compnerd Subscribers: jgorbe, mgorny, christof, llvm-commits, fedor.sergeev, JDevlieghere, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D55763 llvm-svn: 351044
* Revert "[Sparc] Add Sparc V8 support"Jorge Gorbe Moya2019-01-108-282/+2
| | | | | | This reverts commit r350705. llvm-svn: 350787
* [Sparc] Add Sparc V8 supportDaniel Cederman2019-01-098-2/+282
| | | | | | | | | | | | | | | | | | | | | | Summary: Adds the register class implementation for Sparc. Adds support for DW_CFA_GNU_window_save. Adds save and restore context functionality. On Sparc the return address is the address of the call instruction, so an offset needs to be added when returning to skip the call instruction and its delay slot. If the function returns a struct it is also necessary to skip one extra instruction. Reviewers: jyknight, mclow.lists, mstorsjo, compnerd Reviewed By: compnerd Subscribers: fedor.sergeev, JDevlieghere, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D55763 llvm-svn: 350705
* [SEH] Add initial support for AArch64Martin Storsjo2018-12-182-1/+70
| | | | | | | | | | | | | This doesn't yet implement inspecting the .pdata/.xdata to find the LSDA pointer (in UnwindCursor::getInfoFromSEH), but normal C++ exception handling seems to run just fine without it. (The only place I can see where it's even referenced is in unwind_phase2_forced, and I can't find a codepath where libcxxabi would end up calling that.) Differential Revision: https://reviews.llvm.org/D55674 llvm-svn: 349532
* [AArch64][libunwind] Unwinding support for return address signing with B KeyLuke Cheeseman2018-12-172-3/+18
| | | | | | | | | | - Support for the case where the return address has been signed with the B key - When the B key is used, a 'B' character is present in the augmentation string of CIE associated with the FDE for the function. Differential Revision: https://reviews.llvm.org/D55704 llvm-svn: 349339
* [AArch64][libunwind] Unwinding support for return address signingLuke Cheeseman2018-12-144-2/+40
| | | | | | | | | | | | | | - Follow up to revision r342895 - gcc would not build libunwind with the earlier patch as the autia1716 instruction wasn't allowed to be assembled for pre armv8.3a targets - The autia1716 instruction lives in the hint space encodings so is a valid instruction for all armv8a targets - To work around this I have swapped out the autia1716 instruction for the hint instruction Differential Revision: https://reviews.llvm.org/D55700 llvm-svn: 349140
* Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC.Martin Storsjo2018-12-122-116/+10
| | | | | | | | This requires making Registers_*::getRegisterName static. Differential Revision: https://reviews.llvm.org/D55610 llvm-svn: 348981
* [cmake] Rename append_if to avoid collision with LLVMMichal Gorny2018-12-111-10/+10
| | | | | | | | | | | Rename the 'append_if' macro used in libunwind to 'unwind_append_if'. Otherwise, when used in a combined LLVM+libunwind build, it overrides the *incompatible* 'append_if' function from LLVM and breaks projects following libunwind, e.g. OpenMP. Differential Revision: https://reviews.llvm.org/D55476 llvm-svn: 348852
* [SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before ↵Martin Storsjo2018-12-111-0/+2
| | | | | | | | calling RtlUnwindEx This fixes PR39935. llvm-svn: 348836
* Don't export assembly functions when function visibility annotations are ↵Martin Storsjo2018-12-111-0/+4
| | | | | | | | | | disabled Patch by Peiyuan Song! Differential Revision: https://reviews.llvm.org/D55537 llvm-svn: 348832
* [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.Charles Davis2018-10-081-1/+6
| | | | | | | | | | | | | | | | | | Summary: If `-nodefaultlibs` is given, we weren't actually linking to it. This was true irrespective of passing `-rtlib=compiler-rt` (see previous patch). Now we explicitly link it to handle that case. I wonder if we should be linking these libraries only if we're using `-nodefaultlibs`... Reviewers: beanz Subscribers: dberris, mgorny, christof, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D51657 llvm-svn: 343990
* Reverting r342895Luke Cheeseman2018-09-244-38/+2
| | | | | | - The used builtins do not compile for pre arm v8.3a targets with gcc llvm-svn: 342901
* [AArch64] Unwinding support for return address signingLuke Cheeseman2018-09-244-2/+38
| | | | | | | | | | - When return address signing is enabled, the LR may be signed on function entry - When an exception is thrown the return address is inspected used to unwind the call stack - Before this happens, the return address must be correctly authenticated to avoid causing an abort by dereferencing the signed pointer Differential Revision: https://reviews.llvm.org/D51432 llvm-svn: 342895
* [libunwind][NFC] Suppress unused parameter warningsLouis Dionne2018-09-221-1/+4
| | | | | | | | | | Reviewers: EricWF Subscribers: christof, chrib, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D52393 llvm-svn: 342811
* [CMake] Remove variable reference that isn't used.Charles Davis2018-09-041-1/+1
| | | | | | | | | | | | | | | Summary: This variable is never defined, so its value is always empty. Since `libunwind` is needed to build the C++ ABI library in the first place, it should never be linked to the C++ ABI library anyway. Reviewers: mstorsjo, rnk Subscribers: mgorny, christof, cfe-commits Differential Revision: https://reviews.llvm.org/D51644 llvm-svn: 341388
* Export public functions implemented in assembly on Windows.Charles Davis2018-08-311-0/+8
| | | | | | | | | | | | | | | Summary: By default, symbols aren't visible outside of the module that defines them. To make them visible, they must be exported. The easiest way to do that is to embed an `-export:symname` directive into the object file. Reviewers: mstorsjo, rnk Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D51508 llvm-svn: 341232
* Fix existing code for SEH on ARM to compile correctlyMartin Storsjo2018-08-312-8/+13
| | | | | | | | | | | | | | | | | | | | Even though SEH for ARM is incomplete, make what code already exists at least compile correctly. The _LIBUNWIND_CURSOR_SIZE wasn't correct. ARM (and AArch64) have a DISPATCHER_CONTEXT field named TargetPc instead of TargetIp. For the libunwind.h UNW_* constants, there is no UNW_ARM_PC, only UNW_ARM_IP. Don't use 'r' as loop variable when 'r' already is a Registers_arm member. Differential Revision: https://reviews.llvm.org/D51530 llvm-svn: 341217
* [AddressSpace] Use the macro to set hidden visibility on LocalAddressSpace.Charles Davis2018-08-311-1/+1
| | | | | | | | | | | | | | Summary: That attribute has no effect on Windows anyway--classes are hidden by default. Reviewers: mstorsjo, rnk Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D51509 llvm-svn: 341210
* Add support for SEH unwinding on Windows.Charles Davis2018-08-307-3/+1068
| | | | | | | | | | | | | | | | | | | | | Summary: I've tested this implementation on x86-64 to ensure that it works. All `libc++abi` tests pass, as do all `libc++` exception-related tests. ARM still remains to be implemented (@compnerd?). Special thanks to KJK::Hyperion for his excellent series of articles on how EH works on x86-64 Windows. (Seriously, check it out. It's awesome.) I'm actually not sure if this should go in as is. I particularly don't like that I duplicated the UnwindCursor class for this special case. Reviewers: mstorsjo, rnk, compnerd, smeenai, javed.absar Subscribers: mgorny, kristof.beyls, christof, chrib, cfe-commits, compnerd, llvm-commits Differential Revision: https://reviews.llvm.org/D50564 llvm-svn: 341125
* [libunwind][mips] Include gcc_s for linkageStefan Maksimovic2018-08-161-0/+1
| | | | | | | | | When compiling with optimizations, mips requires various helper routines(__ashldi3 and the like) contained in libgcc_s. Conditionally include libgcc_s in the set of libraries to be linked to. Differential Revision: https://reviews.llvm.org/D50243 llvm-svn: 339878
* [libunwind][mips] Guard accumulator registersStefan Maksimovic2018-08-161-0/+4
| | | | | | | | Mipsr6 does not possess HI and LO accumulator registers, adjust validRegister functions to respect that. Differential Revision: https://reviews.llvm.org/D50244 llvm-svn: 339849
* [libunwind][mips] Modify the __mips_fpr macro checkStefan Maksimovic2018-08-162-2/+2
| | | | | | | | The __mips_fpr macro can take the value of 0 as well, change to account for that case. Differential Revision: https://reviews.llvm.org/D50245 llvm-svn: 339848
* [cmake] Add MINGW_LIBRARIES to the linker flagsMartin Storsjo2018-08-141-0/+3
| | | | | | | | | | | | | | | | | This is essential when building with -nodefaultlibs. In some CMake versions (noticed in 3.5.1), the same libraries are picked up from CMAKE_REQUIRED_LIBRARIES in some exceptional situations (if CXX probing failed, due to libc++ not being built yet, the libraries from CMAKE_REQUIRED_LIBRARIES are used for linking the target library), but not at all in other newer CMake versions (3.10). This is similar to what already is done in libcxxabi in SVN r302760 and libcxx in SVN r312498. Differential Revision: https://reviews.llvm.org/D50663 llvm-svn: 339642
* [libunwind] Fix pointer-to-integer cast warnings on LLP64.Charles Davis2018-08-082-8/+8
| | | | | | | | | | | | | | Summary: `long` is too short on LLP64. We have to use `intptr_t` to avoid truncating pointers. Reviewers: mstorsjo, rnk, compnerd, smeenai Subscribers: christof, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50412 llvm-svn: 339217
* [CMake] Option to control whether shared/static library is installedPetr Hosek2018-07-241-6/+10
| | | | | | | | | | | | | Currently it's only possible to control whether shared or static library build of libc++, libc++abi and libunwind is enabled or disabled and whether to install everything we've built or not. However, it'd be useful to have more fine grained control, e.g. when static libraries are merged together into libc++.a we don't need to install libc++abi.a and libunwind.a. This change adds this option. Differential Revision: https://reviews.llvm.org/D49573 llvm-svn: 337867
* The semantics of DW_CFA_GNU_args_size have changed subtile over theJoerg Sonnenberger2018-07-172-3/+13
| | | | | | | | | | years. Adopt the new convention that it is call-site specific and that it should be applied before moving the IP by personality routines, but not during normal unwinding. Differential Revision: https://reviews.llvm.org/D38680 llvm-svn: 337312
* Introduce a separate preprocessor macro, _LIBUNWIND_USE_DLADDR, for directly ↵Jordan Rupprecht2018-06-291-2/+10
| | | | | | | | | | | | controlling a dependency on dladdr(). This will allow us to use libunwind without adding a libdl dependency. Reviewers: saugustine Subscribers: christof, chrib, cfe-commits, echristo Differential Revision: https://reviews.llvm.org/D48733 llvm-svn: 336014
* [OR1K] Add the EPCR special-purpose register to register state.whitequark2018-05-162-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it possible to unwind hardware exception stack frames, which necessarily save every register and so need an extra column for storing the return address. CFI for the exception handler could then look as follows: .globl exception_vector exception_vector: .cfi_startproc .cfi_signal_frame .cfi_return_column 32 l.addi r1, r1, -0x100 .cfi_def_cfa_offset 0x100 l.sw 0x00(r1), r2 .cfi_offset 2, 0x00-0x100 l.sw 0x04(r1), r3 .cfi_offset 3, 0x04-0x100 l.sw 0x08(r1), r4 .cfi_offset 4, 0x08-0x100 l.mfspr r3, r0, SPR_EPCR_BASE l.sw 0x78(r1), r3 .cfi_offset 32, 0x78-0x100 l.jal exception_handler l.nop l.lwz r2, 0x00(r1) l.lwz r3, 0x04(r1) l.lwz r4, 0x08(r1) l.jr r9 l.nop .cfi_endproc This register could, of course, also be accessed by the trace callback or personality function, if so desired. llvm-svn: 332513
* [OR1K] Add a dedicated PC register to register state.whitequark2018-05-163-7/+12
| | | | | | | | | | | | Before this commit, R9, the link register, was used as PC register. However, a stack frame may have R9 not set to PC on entry, either because it uses a custom calling convention, or, more likely, because this is a signal or exception stack frame. Using R9 as PC register made it impossible to unwind such frames. All other architectures similarly use a dedicated PC register. llvm-svn: 332512
* [libunwind][MIPS] Support MIPS floating-point registers for hard-float ABIs.John Baldwin2018-05-154-18/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: For MIPS ABIs with 64-bit floating point registers including newabi and O32 with 64-bit floating point registers, just save and restore the 32 floating-point registers as doubles. For O32 MIPS with 32-bit floating-point registers, save and restore the individual floating-point registers as "plain" registers. These registers are encoded as floats rather than doubles, but the DWARF unwinder assumes that floating-point registers are stored as doubles when reading them from memory (via AddressSpace::getDouble()). Treating the registers as "normal" registers instead causes the DWARF unwinder to fetch them from memory as a 32-bit register. This does mean that for O32 with 32-bit floating-point registers unw_get_fpreg() and unw_set_fpreg() do not work. One would have to use unw_get_reg() and unw_set_reg() instead. However, DWARF unwinding works correctly as the DWARF CFI emits records for individual 32-bit floating-point registers even when they are treated as doubles stored in paired registers. If the lack of unw_get/set_fpreg() becomes a pressing need in the future for O32 MIPS we could add in special handling to make it work. Reviewers: sdardis, compnerd Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D41968 llvm-svn: 332414
* [cmake] Remove duplicate command line options from buildAaron Smith2018-04-051-2/+2
| | | | | | | | | | | | | CMAKE_CXX_FLAGS and CMAKE_C_FLAGS are added twice to the command line. This causes the command line options to be doubled which works until it doesn't as not all options can be specified twice. For example, clang-cl foo.c /GS- /GS- -mllvm -small-loop-cost=1 -mllvm -small-loop-cost=1 clang (LLVM option parsing): for the -small-loop-cost option: may only occur zero or one times! llvm-svn: 329340
* [libunwind][MIPS]: Add support for unwinding in N32 processes.John Baldwin2018-02-275-9/+27
| | | | | | | | | | | | | | | | | | | | | | | Summary: N32 uses the same register context as N64. However, N32 requires one change to properly fetch addresses from registers stored in memory. Since N32 is an ILP32 platform, getP() only fetches the first 32-bits of a stored register. For a big-endian platform this fetches the upper 32-bits which will be zero. To fix this, add a new getRegister() method to AddressSpace which is responsible for extracting the address stored in a register in memory. This matches getP() for all current ABIs except for N32 where it reads the 64-bit register and returns the low 32-bits as an address. The DwarfInstructions::getSavedRegister() method uses AddressSpace::getRegister() instead of AddressSpace::getP(). Reviewers: sdardis, compnerd Reviewed By: sdardis Differential Revision: https://reviews.llvm.org/D39074 llvm-svn: 326250
* [cmake] [libunwind] LLVM_FOUND isn't always set, so just test ifDon Hinton2018-01-271-1/+1
| | | | | | llvm_setup_rpath() is available instead. llvm-svn: 323601
* Don't enable _LIBUNWIND_BUILD_ZERO_COST_APIS if building the SJLJ APIsMartin Storsjo2018-01-261-0/+2
| | | | | | | | | | | | Otherwise, a shared library build with SJLJ APIs enabled would end up with duplicate symbols. This didn't occur for the apple && arm case due to specifically checking for that in the surrounding ifdef. Differential Revision: https://reviews.llvm.org/D42555 llvm-svn: 323499
* [cmake] [libunwind] Call llvm_setup_rpath() when adding shared libraries.Don Hinton2018-01-261-0/+3
| | | | | | | | | Clang and llvm already use llvm_setup_rpath(), so this change will help standarize rpath usage across all projects. Differential Revision: https://reviews.llvm.org/D42461 llvm-svn: 323496
* [PPC64] Added vector registers.Martin Storsjo2018-01-165-245/+622
| | | | | | | | | | | | | | | | The Registers_ppc64 class needed a couple of changes, both to accommodate the new registers as well as to handle the overlaps of VS register set without wasting space. The save/restore code of V and VS registers was added. As VS registers depend on the VMX extension, they are processed only if VMX support is detected (_ARCH_PWR8 for now). Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D41906 llvm-svn: 322596
* [libunwind][MIPS]: Rename Registers_mips_n64 to Registers_mips_newabi.John Baldwin2018-01-094-38/+38
| | | | | | | | | | | This is in preparation for adding support for N32 unwinding which reuses the newabi register class. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D41842 llvm-svn: 322093
* Reland [PPC64] Port to ppc64le - initial versionMartin Storsjo2018-01-028-3/+808
| | | | | | | | | | | | | | | | | | | | | Initial working version of libunwind for PowerPC 64. Tested on little-endian ppc64 host only. Based on the existing PowerPC 32 code. It supports: - context save/restore (unw_getcontext, unw_init_local, unw_resume) - read/write from/to saved registers - backtrace (unw_step) Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D41386 Now builds with LIBUNWIND_ENABLE_CROSS_UNWINDING=ON should work. llvm-svn: 321680
* Don't use a strict larger-than comparison in the check_fit/does_fit static ↵Martin Storsjo2018-01-021-1/+1
| | | | | | | | | | | | | | assert For builds that only target one architecture, this was required to be an exact match, while it previously required the allocation to be strictly larger than the largest concrete one. Requiring it to be larger than on equal should be enough. This makes it more straightforward to update _LIBUNWIND_CONTEXT_SIZE and _LIBUNWIND_CURSOR_SIZE. llvm-svn: 321679
* Revert `rL321667: [PPC64] Port to ppc64le - initial version`Tim Shen2018-01-028-808/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D41386 llvm-svn: 321678
OpenPOWER on IntegriCloud