Date: Thu, 22 Aug 2019 20:14:59 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r351404 - in projects/clang900-import/contrib/libunwind: . include include/mach-o src Message-ID: <201908222014.x7MKExJH088589@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Thu Aug 22 20:14:59 2019 New Revision: 351404 URL: https://svnweb.freebsd.org/changeset/base/351404 Log: Merge libunwind trunk r366426, resolve conflicts, and add FREEBSD-Xlist. Added: projects/clang900-import/contrib/libunwind/FREEBSD-Xlist (contents, props changed) Modified: projects/clang900-import/contrib/libunwind/LICENSE.TXT projects/clang900-import/contrib/libunwind/include/__libunwind_config.h projects/clang900-import/contrib/libunwind/include/libunwind.h projects/clang900-import/contrib/libunwind/include/mach-o/compact_unwind_encoding.h projects/clang900-import/contrib/libunwind/include/unwind.h projects/clang900-import/contrib/libunwind/src/AddressSpace.hpp projects/clang900-import/contrib/libunwind/src/CompactUnwinder.hpp projects/clang900-import/contrib/libunwind/src/DwarfInstructions.hpp projects/clang900-import/contrib/libunwind/src/DwarfParser.hpp projects/clang900-import/contrib/libunwind/src/EHHeaderParser.hpp projects/clang900-import/contrib/libunwind/src/RWMutex.hpp projects/clang900-import/contrib/libunwind/src/Registers.hpp projects/clang900-import/contrib/libunwind/src/Unwind-EHABI.cpp projects/clang900-import/contrib/libunwind/src/Unwind-EHABI.h projects/clang900-import/contrib/libunwind/src/Unwind-seh.cpp projects/clang900-import/contrib/libunwind/src/Unwind-sjlj.c projects/clang900-import/contrib/libunwind/src/UnwindCursor.hpp projects/clang900-import/contrib/libunwind/src/UnwindLevel1-gcc-ext.c projects/clang900-import/contrib/libunwind/src/UnwindLevel1.c projects/clang900-import/contrib/libunwind/src/UnwindRegistersRestore.S projects/clang900-import/contrib/libunwind/src/UnwindRegistersSave.S projects/clang900-import/contrib/libunwind/src/Unwind_AppleExtras.cpp projects/clang900-import/contrib/libunwind/src/assembly.h projects/clang900-import/contrib/libunwind/src/config.h projects/clang900-import/contrib/libunwind/src/dwarf2.h projects/clang900-import/contrib/libunwind/src/libunwind.cpp projects/clang900-import/contrib/libunwind/src/libunwind_ext.h Directory Properties: projects/clang900-import/contrib/libunwind/ (props changed) Added: projects/clang900-import/contrib/libunwind/FREEBSD-Xlist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/clang900-import/contrib/libunwind/FREEBSD-Xlist Thu Aug 22 20:14:59 2019 (r351404) @@ -0,0 +1,11 @@ +# $FreeBSD$ +.arcconfig +.clang-format +CMakeLists.txt +cmake +cmake/ +docs +docs/ +src/CMakeLists.txt +test +test/ Modified: projects/clang900-import/contrib/libunwind/LICENSE.TXT ============================================================================== --- projects/clang900-import/contrib/libunwind/LICENSE.TXT Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/LICENSE.TXT Thu Aug 22 20:14:59 2019 (r351404) @@ -1,5 +1,240 @@ ============================================================================== -libunwind License +The LLVM Project is under the Apache License v2.0 with LLVM Exceptions: +============================================================================== + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + +---- LLVM Exceptions to the Apache 2.0 License ---- + +As an exception, if, as a result of your compiling your source code, portions +of this Software are embedded into an Object form of such source code, you +may redistribute such embedded portions in such Object form without complying +with the conditions of Sections 4(a), 4(b) and 4(d) of the License. + +In addition, if you combine or link compiled forms of this Software with +software that is licensed under the GPLv2 ("Combined Software") and if a +court of competent jurisdiction determines that the patent provision (Section +3), the indemnity provision (Section 9) or other Section of the License +conflicts with the conditions of the GPLv2, you may retroactively and +prospectively choose to deem waived or otherwise exclude such Section(s) of +the License, but only in their entirety and only with respect to the Combined +Software. + +============================================================================== +Software from third parties included in the LLVM Project: +============================================================================== +The LLVM Project contains third party software which is under different license +terms. All such code will be identified clearly using at least one of two +mechanisms: +1) It will be in a separate directory tree with its own `LICENSE.txt` or + `LICENSE` file at the top containing the specific license and restrictions + which apply to that software, or +2) It will contain specific license and restriction terms at the top of every + file. + +============================================================================== +Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): ============================================================================== The libunwind library is dual licensed under both the University of Illinois Modified: projects/clang900-import/contrib/libunwind/include/__libunwind_config.h ============================================================================== --- projects/clang900-import/contrib/libunwind/include/__libunwind_config.h Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/include/__libunwind_config.h Thu Aug 22 20:14:59 2019 (r351404) @@ -1,9 +1,8 @@ //===------------------------- __libunwind_config.h -----------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// Modified: projects/clang900-import/contrib/libunwind/include/libunwind.h ============================================================================== --- projects/clang900-import/contrib/libunwind/include/libunwind.h Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/include/libunwind.h Thu Aug 22 20:14:59 2019 (r351404) @@ -1,11 +1,10 @@ //===---------------------------- libunwind.h -----------------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // Compatible with libunwind API documented at: // http://www.nongnu.org/libunwind/man/libunwind(3).html // @@ -76,7 +75,7 @@ typedef struct unw_addr_space *unw_addr_space_t; typedef int unw_regnum_t; typedef uintptr_t unw_word_t; -#if defined(__arm__) +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) typedef uint64_t unw_fpreg_t; #else typedef double unw_fpreg_t; @@ -124,32 +123,6 @@ extern int unw_get_proc_name(unw_cursor_t *, char *, s //extern int unw_get_save_loc(unw_cursor_t*, int, unw_save_loc_t*); extern unw_addr_space_t unw_local_addr_space; - -#ifdef UNW_REMOTE -/* - * Mac OS X "remote" API for unwinding other processes on same machine - * - */ -extern unw_addr_space_t unw_create_addr_space_for_task(task_t); -extern void unw_destroy_addr_space(unw_addr_space_t); -extern int unw_init_remote_thread(unw_cursor_t *, unw_addr_space_t, thread_t *); -#endif /* UNW_REMOTE */ - -/* - * traditional libunwind "remote" API - * NOT IMPLEMENTED on Mac OS X - * - * extern int unw_init_remote(unw_cursor_t*, unw_addr_space_t, - * thread_t*); - * extern unw_accessors_t unw_get_accessors(unw_addr_space_t); - * extern unw_addr_space_t unw_create_addr_space(unw_accessors_t, int); - * extern void unw_flush_cache(unw_addr_space_t, unw_word_t, - * unw_word_t); - * extern int unw_set_caching_policy(unw_addr_space_t, - * unw_caching_policy_t); - * extern void _U_dyn_register(unw_dyn_info_t*); - * extern void _U_dyn_cancel(unw_dyn_info_t*); - */ #ifdef __cplusplus } Modified: projects/clang900-import/contrib/libunwind/include/mach-o/compact_unwind_encoding.h ============================================================================== --- projects/clang900-import/contrib/libunwind/include/mach-o/compact_unwind_encoding.h Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/include/mach-o/compact_unwind_encoding.h Thu Aug 22 20:14:59 2019 (r351404) @@ -1,9 +1,8 @@ //===------------------ mach-o/compact_unwind_encoding.h ------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // // Darwin's alternative to DWARF based unwind encodings. Modified: projects/clang900-import/contrib/libunwind/include/unwind.h ============================================================================== --- projects/clang900-import/contrib/libunwind/include/unwind.h Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/include/unwind.h Thu Aug 22 20:14:59 2019 (r351404) @@ -1,13 +1,12 @@ //===------------------------------- unwind.h -----------------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // C++ ABI Level 1 ABI documented at: -// http://mentorembedded.github.io/cxx-abi/abi-eh.html +// https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html // //===----------------------------------------------------------------------===// Modified: projects/clang900-import/contrib/libunwind/src/AddressSpace.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/AddressSpace.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/AddressSpace.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,11 +1,10 @@ //===------------------------- AddressSpace.hpp ---------------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // Abstracts accessing local vs remote address spaces. // //===----------------------------------------------------------------------===// @@ -28,7 +27,10 @@ #if _LIBUNWIND_USE_DLADDR #include <dlfcn.h> +#if defined(__unix__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) +#pragma comment(lib, "dl") #endif +#endif #ifdef __APPLE__ #include <mach-o/getsect.h> @@ -457,6 +459,8 @@ inline bool LocalAddressSpace::findUnwindSections(pint #elif defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32) // Don't even bother, since Windows has functions that do all this stuff // for us. + (void)targetAddr; + (void)info; return true; #elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) && \ (__ANDROID_API__ < 21) @@ -597,141 +601,14 @@ inline bool LocalAddressSpace::findFunctionName(pint_t return true; } } +#else + (void)addr; + (void)buf; + (void)bufLen; + (void)offset; #endif return false; } - - - -#ifdef UNW_REMOTE - -/// RemoteAddressSpace is used as a template parameter to UnwindCursor when -/// unwinding a thread in the another process. The other process can be a -/// different endianness and a different pointer size which is handled by -/// the P template parameter. -template <typename P> -class RemoteAddressSpace { -public: - RemoteAddressSpace(task_t task) : fTask(task) {} - - typedef typename P::uint_t pint_t; - - uint8_t get8(pint_t addr); - uint16_t get16(pint_t addr); - uint32_t get32(pint_t addr); - uint64_t get64(pint_t addr); - pint_t getP(pint_t addr); - uint64_t getRegister(pint_t addr); - uint64_t getULEB128(pint_t &addr, pint_t end); - int64_t getSLEB128(pint_t &addr, pint_t end); - pint_t getEncodedP(pint_t &addr, pint_t end, uint8_t encoding, - pint_t datarelBase = 0); - bool findFunctionName(pint_t addr, char *buf, size_t bufLen, - unw_word_t *offset); - bool findUnwindSections(pint_t targetAddr, UnwindInfoSections &info); - bool findOtherFDE(pint_t targetAddr, pint_t &fde); -private: - void *localCopy(pint_t addr); - - task_t fTask; -}; - -template <typename P> uint8_t RemoteAddressSpace<P>::get8(pint_t addr) { - return *((uint8_t *)localCopy(addr)); -} - -template <typename P> uint16_t RemoteAddressSpace<P>::get16(pint_t addr) { - return P::E::get16(*(uint16_t *)localCopy(addr)); -} - -template <typename P> uint32_t RemoteAddressSpace<P>::get32(pint_t addr) { - return P::E::get32(*(uint32_t *)localCopy(addr)); -} - -template <typename P> uint64_t RemoteAddressSpace<P>::get64(pint_t addr) { - return P::E::get64(*(uint64_t *)localCopy(addr)); -} - -template <typename P> -typename P::uint_t RemoteAddressSpace<P>::getP(pint_t addr) { - return P::getP(*(uint64_t *)localCopy(addr)); -} - -template <typename P> -typename P::uint_t OtherAddressSpace<P>::getRegister(pint_t addr) { - return P::getRegister(*(uint64_t *)localCopy(addr)); -} - -template <typename P> -uint64_t OtherAddressSpace<P>::getULEB128(pint_t &addr, pint_t end) { - uintptr_t size = (end - addr); - LocalAddressSpace::pint_t laddr = (LocalAddressSpace::pint_t) localCopy(addr); - LocalAddressSpace::pint_t sladdr = laddr; - uint64_t result = LocalAddressSpace::getULEB128(laddr, laddr + size); - addr += (laddr - sladdr); - return result; -} - -template <typename P> -int64_t RemoteAddressSpace<P>::getSLEB128(pint_t &addr, pint_t end) { - uintptr_t size = (end - addr); - LocalAddressSpace::pint_t laddr = (LocalAddressSpace::pint_t) localCopy(addr); - LocalAddressSpace::pint_t sladdr = laddr; - uint64_t result = LocalAddressSpace::getSLEB128(laddr, laddr + size); - addr += (laddr - sladdr); - return result; -} - -template <typename P> void *RemoteAddressSpace<P>::localCopy(pint_t addr) { - // FIX ME -} - -template <typename P> -bool RemoteAddressSpace<P>::findFunctionName(pint_t addr, char *buf, - size_t bufLen, - unw_word_t *offset) { - // FIX ME -} - -/// unw_addr_space is the base class that abstract unw_addr_space_t type in -/// libunwind.h points to. -struct unw_addr_space { - cpu_type_t cpuType; - task_t taskPort; -}; - -/// unw_addr_space_i386 is the concrete instance that a unw_addr_space_t points -/// to when examining -/// a 32-bit intel process. -struct unw_addr_space_i386 : public unw_addr_space { - unw_addr_space_i386(task_t task) : oas(task) {} - RemoteAddressSpace<Pointer32<LittleEndian>> oas; -}; - -/// unw_addr_space_x86_64 is the concrete instance that a unw_addr_space_t -/// points to when examining -/// a 64-bit intel process. -struct unw_addr_space_x86_64 : public unw_addr_space { - unw_addr_space_x86_64(task_t task) : oas(task) {} - RemoteAddressSpace<Pointer64<LittleEndian>> oas; -}; - -/// unw_addr_space_ppc is the concrete instance that a unw_addr_space_t points -/// to when examining -/// a 32-bit PowerPC process. -struct unw_addr_space_ppc : public unw_addr_space { - unw_addr_space_ppc(task_t task) : oas(task) {} - RemoteAddressSpace<Pointer32<BigEndian>> oas; -}; - -/// unw_addr_space_ppc is the concrete instance that a unw_addr_space_t points -/// to when examining a 64-bit PowerPC process. -struct unw_addr_space_ppc64 : public unw_addr_space { - unw_addr_space_ppc64(task_t task) : oas(task) {} - RemoteAddressSpace<Pointer64<LittleEndian>> oas; -}; - -#endif // UNW_REMOTE } // namespace libunwind Modified: projects/clang900-import/contrib/libunwind/src/CompactUnwinder.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/CompactUnwinder.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/CompactUnwinder.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,9 +1,8 @@ //===-------------------------- CompactUnwinder.hpp -----------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // // Does runtime stack unwinding using compact unwind encodings. Modified: projects/clang900-import/contrib/libunwind/src/DwarfInstructions.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/DwarfInstructions.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/DwarfInstructions.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,11 +1,10 @@ //===-------------------------- DwarfInstructions.hpp ---------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // Processor specific interpretation of DWARF unwind info. // //===----------------------------------------------------------------------===// @@ -82,12 +81,11 @@ typename A::pint_t DwarfInstructions<A, R>::getSavedRe const RegisterLocation &savedReg) { switch (savedReg.location) { case CFI_Parser<A>::kRegisterInCFA: - return addressSpace.getRegister(cfa + (pint_t)savedReg.value); + return (pint_t)addressSpace.getRegister(cfa + (pint_t)savedReg.value); case CFI_Parser<A>::kRegisterAtExpression: - return addressSpace.getRegister( - evaluateExpression((pint_t)savedReg.value, addressSpace, - registers, cfa)); + return (pint_t)addressSpace.getRegister(evaluateExpression( + (pint_t)savedReg.value, addressSpace, registers, cfa)); case CFI_Parser<A>::kRegisterIsExpression: return evaluateExpression((pint_t)savedReg.value, addressSpace, Modified: projects/clang900-import/contrib/libunwind/src/DwarfParser.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/DwarfParser.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/DwarfParser.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,9 +1,8 @@ //===--------------------------- DwarfParser.hpp --------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // // Parses DWARF CFIs (FDEs and CIEs). Modified: projects/clang900-import/contrib/libunwind/src/EHHeaderParser.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/EHHeaderParser.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/EHHeaderParser.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,9 +1,8 @@ //===------------------------- EHHeaderParser.hpp -------------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // // Parses ELF .eh_frame_hdr sections. Modified: projects/clang900-import/contrib/libunwind/src/RWMutex.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/RWMutex.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/RWMutex.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,11 +1,10 @@ //===----------------------------- Registers.hpp --------------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // Abstract interface to shared reader/writer log, hiding platform and // configuration differences. // @@ -18,7 +17,10 @@ #include <windows.h> #elif !defined(_LIBUNWIND_HAS_NO_THREADS) #include <pthread.h> +#if defined(__unix__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) +#pragma comment(lib, "pthread") #endif +#endif namespace libunwind { @@ -57,14 +59,49 @@ class _LIBUNWIND_HIDDEN RWMutex { (private) SRWLOCK _lock = SRWLOCK_INIT; }; -#else +#elif !defined(LIBUNWIND_USE_WEAK_PTHREAD) class _LIBUNWIND_HIDDEN RWMutex { public: - bool lock_shared() { return pthread_rwlock_rdlock(&_lock) == 0; } + bool lock_shared() { return pthread_rwlock_rdlock(&_lock) == 0; } bool unlock_shared() { return pthread_rwlock_unlock(&_lock) == 0; } bool lock() { return pthread_rwlock_wrlock(&_lock) == 0; } bool unlock() { return pthread_rwlock_unlock(&_lock) == 0; } + +private: + pthread_rwlock_t _lock = PTHREAD_RWLOCK_INITIALIZER; +}; + +#else + +extern "C" int __attribute__((weak)) +pthread_create(pthread_t *thread, const pthread_attr_t *attr, + void *(*start_routine)(void *), void *arg); +extern "C" int __attribute__((weak)) +pthread_rwlock_rdlock(pthread_rwlock_t *lock); +extern "C" int __attribute__((weak)) +pthread_rwlock_wrlock(pthread_rwlock_t *lock); +extern "C" int __attribute__((weak)) +pthread_rwlock_unlock(pthread_rwlock_t *lock); + +// Calls to the locking functions are gated on pthread_create, and not the +// functions themselves, because the data structure should only be locked if +// another thread has been created. This is what similar libraries do. + +class _LIBUNWIND_HIDDEN RWMutex { +public: + bool lock_shared() { + return !pthread_create || (pthread_rwlock_rdlock(&_lock) == 0); + } + bool unlock_shared() { + return !pthread_create || (pthread_rwlock_unlock(&_lock) == 0); + } + bool lock() { + return !pthread_create || (pthread_rwlock_wrlock(&_lock) == 0); + } + bool unlock() { + return !pthread_create || (pthread_rwlock_unlock(&_lock) == 0); + } private: pthread_rwlock_t _lock = PTHREAD_RWLOCK_INITIALIZER; Modified: projects/clang900-import/contrib/libunwind/src/Registers.hpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/Registers.hpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/Registers.hpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,11 +1,10 @@ //===----------------------------- Registers.hpp --------------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // Models register sets for supported processors. // //===----------------------------------------------------------------------===// @@ -2105,16 +2104,16 @@ class _LIBUNWIND_HIDDEN Registers_arm { (private) uint32_t __pc; // Program counter r15 }; - static void saveVFPWithFSTMD(unw_fpreg_t*); - static void saveVFPWithFSTMX(unw_fpreg_t*); - static void saveVFPv3(unw_fpreg_t*); - static void restoreVFPWithFLDMD(unw_fpreg_t*); - static void restoreVFPWithFLDMX(unw_fpreg_t*); - static void restoreVFPv3(unw_fpreg_t*); + static void saveVFPWithFSTMD(void*); + static void saveVFPWithFSTMX(void*); + static void saveVFPv3(void*); + static void restoreVFPWithFLDMD(void*); + static void restoreVFPWithFLDMX(void*); + static void restoreVFPv3(void*); #if defined(__ARM_WMMX) - static void saveiWMMX(unw_fpreg_t*); + static void saveiWMMX(void*); static void saveiWMMXControl(uint32_t*); - static void restoreiWMMX(unw_fpreg_t*); + static void restoreiWMMX(void*); static void restoreiWMMXControl(uint32_t*); #endif void restoreCoreAndJumpTo(); @@ -2156,7 +2155,7 @@ inline Registers_arm::Registers_arm(const void *regist _saved_vfp_d16_d31(false) { static_assert((check_fit<Registers_arm, unw_context_t>::does_fit), "arm registers do not fit into unw_context_t"); - // See unw_getcontext() note about data. + // See __unw_getcontext() note about data. memcpy(&_registers, registers, sizeof(_registers)); memset(&_vfp_d0_d15_pad, 0, sizeof(_vfp_d0_d15_pad)); memset(&_vfp_d16_d31, 0, sizeof(_vfp_d16_d31)); @@ -2435,7 +2434,7 @@ inline const char *Registers_arm::getRegisterName(int inline bool Registers_arm::validFloatRegister(int regNum) const { // NOTE: Consider the intel MMX registers floating points so the - // unw_get_fpreg can be used to transmit the 64-bit data back. + // __unw_get_fpreg can be used to transmit the 64-bit data back. return ((regNum >= UNW_ARM_D0) && (regNum <= UNW_ARM_D31)) #if defined(__ARM_WMMX) || ((regNum >= UNW_ARM_WR0) && (regNum <= UNW_ARM_WR15)) Modified: projects/clang900-import/contrib/libunwind/src/Unwind-EHABI.cpp ============================================================================== --- projects/clang900-import/contrib/libunwind/src/Unwind-EHABI.cpp Thu Aug 22 20:09:32 2019 (r351403) +++ projects/clang900-import/contrib/libunwind/src/Unwind-EHABI.cpp Thu Aug 22 20:14:59 2019 (r351404) @@ -1,11 +1,10 @@ //===--------------------------- Unwind-EHABI.cpp -------------------------===// // -// The LLVM Compiler Infrastructure +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. // -// // Implements ARM zero-cost C++ exceptions // //===----------------------------------------------------------------------===// @@ -21,8 +20,6 @@ #include <stdlib.h> #include <string.h> -#include <type_traits> - #include "config.h" #include "libunwind.h" #include "libunwind_ext.h" @@ -34,7 +31,11 @@ namespace { // signinficant byte. uint8_t getByte(const uint32_t* data, size_t offset) { const uint8_t* byteData = reinterpret_cast<const uint8_t*>(data); +#ifdef __LITTLE_ENDIAN__ return byteData[(offset & ~(size_t)0x03) + (3 - (offset & (size_t)0x03))]; +#else + return byteData[offset]; +#endif } const char* getNextWord(const char* data, uint32_t* out) { @@ -182,7 +183,7 @@ static _Unwind_Reason_Code unwindOneFrame(_Unwind_Stat if (result != _URC_CONTINUE_UNWIND) return result; - if (unw_step(reinterpret_cast<unw_cursor_t*>(context)) != UNW_STEP_SUCCESS) + if (__unw_step(reinterpret_cast<unw_cursor_t *>(context)) != UNW_STEP_SUCCESS) return _URC_FAILURE; return _URC_CONTINUE_UNWIND; } @@ -443,17 +444,18 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, // In this implementation, the phases don't share the VRS backing store. // Instead, they are passed the original |uc| and they create a new VRS // from scratch thus achieving the same effect. - unw_init_local(cursor, uc); + __unw_init_local(cursor, uc); // Walk each frame looking for a place to stop. for (bool handlerNotFound = true; handlerNotFound;) { // See if frame has code to run (has personality routine). unw_proc_info_t frameInfo; - if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE1_ERROR", - static_cast<void *>(exception_object)); + if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { + _LIBUNWIND_TRACE_UNWINDING( + "unwind_phase1(ex_ojb=%p): __unw_get_proc_info " + "failed => _URC_FATAL_PHASE1_ERROR", + static_cast<void *>(exception_object)); return _URC_FATAL_PHASE1_ERROR; } @@ -462,12 +464,12 @@ unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, char functionBuf[512]; const char *functionName = functionBuf; unw_word_t offset; - if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf), - &offset) != UNW_ESUCCESS) || + if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf), + &offset) != UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip)) functionName = ".anonymous."; unw_word_t pc; - unw_get_reg(cursor, UNW_REG_IP, &pc); + __unw_get_reg(cursor, UNW_REG_IP, &pc); _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): pc=0x%" PRIxPTR ", start_ip=0x%" PRIxPTR ", func=%s, " "lsda=0x%" PRIxPTR ", personality=0x%" PRIxPTR, @@ -537,7 +539,7 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t _Unwind_Exception *exception_object, bool resume) { // See comment at the start of unwind_phase1 regarding VRS integrity. - unw_init_local(cursor, uc); + __unw_init_local(cursor, uc); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p)", static_cast<void *>(exception_object)); @@ -559,19 +561,20 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t // for. After this, continue unwinding as if normal. // // See #7.4.6 for details. - unw_set_reg(cursor, UNW_REG_IP, - exception_object->unwinder_cache.reserved2); + __unw_set_reg(cursor, UNW_REG_IP, + exception_object->unwinder_cache.reserved2); resume = false; } // Get info about this frame. unw_word_t sp; unw_proc_info_t frameInfo; - unw_get_reg(cursor, UNW_REG_SP, &sp); - if (unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { - _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): unw_get_proc_info " - "failed => _URC_FATAL_PHASE2_ERROR", - static_cast<void *>(exception_object)); + __unw_get_reg(cursor, UNW_REG_SP, &sp); + if (__unw_get_proc_info(cursor, &frameInfo) != UNW_ESUCCESS) { + _LIBUNWIND_TRACE_UNWINDING( + "unwind_phase2(ex_ojb=%p): __unw_get_proc_info " + "failed => _URC_FATAL_PHASE2_ERROR", + static_cast<void *>(exception_object)); return _URC_FATAL_PHASE2_ERROR; } @@ -580,8 +583,8 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t char functionBuf[512]; const char *functionName = functionBuf; unw_word_t offset; - if ((unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf), - &offset) != UNW_ESUCCESS) || + if ((__unw_get_proc_name(cursor, functionBuf, sizeof(functionBuf), + &offset) != UNW_ESUCCESS) || (frameInfo.start_ip + offset > frameInfo.end_ip)) functionName = ".anonymous."; _LIBUNWIND_TRACE_UNWINDING( @@ -625,8 +628,8 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t // We may get control back if landing pad calls _Unwind_Resume(). if (_LIBUNWIND_TRACING_UNWINDING) { unw_word_t pc; - unw_get_reg(cursor, UNW_REG_IP, &pc); - unw_get_reg(cursor, UNW_REG_SP, &sp); + __unw_get_reg(cursor, UNW_REG_IP, &pc); + __unw_get_reg(cursor, UNW_REG_SP, &sp); _LIBUNWIND_TRACE_UNWINDING("unwind_phase2(ex_ojb=%p): re-entering " "user code with ip=0x%" PRIxPTR ", sp=0x%" PRIxPTR, static_cast<void *>(exception_object), @@ -637,11 +640,11 @@ static _Unwind_Reason_Code unwind_phase2(unw_context_t // EHABI #7.4.1 says we need to preserve pc for when _Unwind_Resume // is called back, to find this same frame. unw_word_t pc; - unw_get_reg(cursor, UNW_REG_IP, &pc); + __unw_get_reg(cursor, UNW_REG_IP, &pc); exception_object->unwinder_cache.reserved2 = (uint32_t)pc; } - unw_resume(cursor); - // unw_resume() only returns if there was an error. + __unw_resume(cursor); + // __unw_resume() only returns if there was an error. return _URC_FATAL_PHASE2_ERROR; // # EHABI #7.4.3 @@ -670,7 +673,7 @@ _Unwind_RaiseException(_Unwind_Exception *exception_ob static_cast<void *>(exception_object)); unw_context_t uc; unw_cursor_t cursor; - unw_getcontext(&uc); + __unw_getcontext(&uc); // This field for is for compatibility with GCC to say this isn't a forced // unwind. EHABI #7.2 @@ -708,7 +711,7 @@ _Unwind_Resume(_Unwind_Exception *exception_object) { static_cast<void *>(exception_object)); unw_context_t uc; unw_cursor_t cursor; - unw_getcontext(&uc); + __unw_getcontext(&uc); // _Unwind_RaiseException on EHABI will always set the reserved1 field to 0, // which is in the same position as private_1 below. @@ -725,7 +728,7 @@ _Unwind_GetLanguageSpecificData(struct _Unwind_Context unw_cursor_t *cursor = (unw_cursor_t *)context; unw_proc_info_t frameInfo; uintptr_t result = 0; - if (unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS) + if (__unw_get_proc_info(cursor, &frameInfo) == UNW_ESUCCESS) result = (uintptr_t)frameInfo.lsda; _LIBUNWIND_TRACE_API( "_Unwind_GetLanguageSpecificData(context=%p) => 0x%llx", @@ -765,8 +768,8 @@ _Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_ case _UVRSC_CORE: if (representation != _UVRSD_UINT32 || regno > 15) return _UVRSR_FAILED; - return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno), - *(unw_word_t *)valuep) == UNW_ESUCCESS + return __unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_R0 + regno), + *(unw_word_t *)valuep) == UNW_ESUCCESS ? _UVRSR_OK : _UVRSR_FAILED; case _UVRSC_VFP: @@ -776,28 +779,28 @@ _Unwind_VRS_Set(_Unwind_Context *context, _Unwind_VRS_ // Can only touch d0-15 with FSTMFDX. if (regno > 15) return _UVRSR_FAILED; - unw_save_vfp_as_X(cursor); + __unw_save_vfp_as_X(cursor); } else { if (regno > 31) return _UVRSR_FAILED; } - return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno), - *(unw_fpreg_t *)valuep) == UNW_ESUCCESS + return __unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_D0 + regno), + *(unw_fpreg_t *)valuep) == UNW_ESUCCESS ? _UVRSR_OK : _UVRSR_FAILED; #if defined(__ARM_WMMX) case _UVRSC_WMMXC: if (representation != _UVRSD_UINT32 || regno > 3) return _UVRSR_FAILED; - return unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno), - *(unw_word_t *)valuep) == UNW_ESUCCESS + return __unw_set_reg(cursor, (unw_regnum_t)(UNW_ARM_WC0 + regno), + *(unw_word_t *)valuep) == UNW_ESUCCESS ? _UVRSR_OK : _UVRSR_FAILED; case _UVRSC_WMMXD: if (representation != _UVRSD_DOUBLE || regno > 31) return _UVRSR_FAILED; - return unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno), - *(unw_fpreg_t *)valuep) == UNW_ESUCCESS + return __unw_set_fpreg(cursor, (unw_regnum_t)(UNW_ARM_WR0 + regno), *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908222014.x7MKExJH088589>