summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/projects/libunwind/src/libunwind.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2016-07-22 17:34:28 +0000
committeremaste <emaste@FreeBSD.org>2016-07-22 17:34:28 +0000
commit5aa5e047c6830259149520f8dec281e51445a349 (patch)
tree2abc045f4630fb0b34d5a620abbdea44e298b5e0 /contrib/llvm/projects/libunwind/src/libunwind.cpp
parentf2acc91a2a10293e24f37092986ca685dcfa04e4 (diff)
downloadFreeBSD-src-5aa5e047c6830259149520f8dec281e51445a349.zip
FreeBSD-src-5aa5e047c6830259149520f8dec281e51445a349.tar.gz
MFC libunwind improvements
r302450: libunwind: update to upstream snapshot r272680 The key improvement is that it may be built without cross-unwinding support, which significantly reduces the stack space requirement. r302456: libunwind: enable only the native unwinder by default This significantly reduces stack space requirements, and runtimes require only native unwinding. r302475: libunwind: limit stack usage in unwind cursor This may be reworked upstream but in the interim should address the stack usage issue reported in the PR. r303016: llvm-libunwind: use conventional (non-Darwin) X86 register numbers For historical reasons Darwin/i386 has ebp and esp swapped in the eh_frame register numbering. That is: Darwin Other Reg # eh_frame eh_frame DWARF ===== ======== ======== ===== 4 ebp esp esp 5 esp ebp ebp Although the UNW_X86_* constants are not supposed to be coupled to DWARF / eh_frame numbering they are currently conflated in LLVM libunwind, and thus we require the non-Darwin numbering. PR: 206384 Approved by: re (kib) Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/llvm/projects/libunwind/src/libunwind.cpp')
-rw-r--r--contrib/llvm/projects/libunwind/src/libunwind.cpp34
1 files changed, 15 insertions, 19 deletions
diff --git a/contrib/llvm/projects/libunwind/src/libunwind.cpp b/contrib/llvm/projects/libunwind/src/libunwind.cpp
index c4e3e45..f8a4e91 100644
--- a/contrib/llvm/projects/libunwind/src/libunwind.cpp
+++ b/contrib/llvm/projects/libunwind/src/libunwind.cpp
@@ -45,33 +45,29 @@ _LIBUNWIND_EXPORT int unw_init_local(unw_cursor_t *cursor,
_LIBUNWIND_TRACE_API("unw_init_local(cursor=%p, context=%p)\n",
static_cast<void *>(cursor),
static_cast<void *>(context));
- // Use "placement new" to allocate UnwindCursor in the cursor buffer.
#if defined(__i386__)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86>(
- context, LocalAddressSpace::sThisAddressSpace);
+# define REGISTER_KIND Registers_x86
#elif defined(__x86_64__)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_x86_64>(
- context, LocalAddressSpace::sThisAddressSpace);
+# define REGISTER_KIND Registers_x86_64
#elif defined(__ppc__)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_ppc>(
- context, LocalAddressSpace::sThisAddressSpace);
-#elif defined(__arm64__) || defined(__aarch64__)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm64>(
- context, LocalAddressSpace::sThisAddressSpace);
+# define REGISTER_KIND Registers_ppc
+#elif defined(__aarch64__)
+# define REGISTER_KIND Registers_arm64
#elif _LIBUNWIND_ARM_EHABI
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_arm>(
- context, LocalAddressSpace::sThisAddressSpace);
+# define REGISTER_KIND Registers_arm
#elif defined(__or1k__)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_or1k>(
- context, LocalAddressSpace::sThisAddressSpace);
-#elif defined(__mips__)
-#warning The MIPS architecture is not supported.
+# define REGISTER_KIND Registers_or1k
#elif defined(__riscv__)
- new ((void *)cursor) UnwindCursor<LocalAddressSpace, Registers_riscv>(
- context, LocalAddressSpace::sThisAddressSpace);
+# define REGISTER_KIND Registers_riscv
+#elif defined(__mips__)
+# warning The MIPS architecture is not supported.
#else
-#error Architecture not supported
+# error Architecture not supported
#endif
+ // Use "placement new" to allocate UnwindCursor in the cursor buffer.
+ new ((void *)cursor) UnwindCursor<LocalAddressSpace, REGISTER_KIND>(
+ context, LocalAddressSpace::sThisAddressSpace);
+#undef REGISTER_KIND
AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor;
co->setInfoBasedOnIPRegister();
OpenPOWER on IntegriCloud