aboutsummaryrefslogtreecommitdiff
path: root/contrib/libcxxrt
Commit message (Collapse)AuthorAgeFilesLines
* Fix memory corruption in C++ demanglerJustine Tunney2024-05-101-1/+1
| | | | | | | | | | | | The __cxa_demangle_gnu3() and cpp_demangle_gnu3() functions segfault on various libcxxabi test cases due to a copy and paste error. This change fixes that. This is a subset of https://github.com/libcxxrt/libcxxrt/pull/34 which fixes the immediate problem. Reviewed by: imp, emaste (I think) Pull Request: https://github.com/freebsd/freebsd-src/pull/1222
* Tentatively apply https://github.com/libcxxrt/libcxxrt/pull/27Dimitry Andric2024-04-062-7/+7
| | | | | | | | | This marks __cxa_allocate_exception, __cxa_free_exception and __cxa_init_primary_exception noexcept, to ensure compatibility with libc++'s declarations. PR: 276104 MFC after: 1 month
* Merge libcxxrt master 03c83f5a57be8c5b1a29a68de5638744f17d28baDimitry Andric2024-01-252-8/+44
| | | | | | | | | | | | Interesting fixes (* were already cherry-picked): - 03c83f5 add __cxa_init_primary_exception (#23) * 5d8a158 Fix two bugs in __cxa_end_cleanup() * b00c6c5 Insert padding in __cxa_dependent_exception * 45ca8b1 Insert padding in __cxa_exception struct for compatibility * f2e5509 Fix unlock in two-word version and add missing comment. - 6229590 Add an option for disabling emergency buffers. (#14) MFC after: 2 weeks
* Merge libcxxrt commit 5d8a15823a103bbc27f1bfdcf2b5aa008fab57ddMark Johnston2022-08-081-1/+3
| | | | | | | | | | | | | | | | | | | Fix two bugs in __cxa_end_cleanup() Per the EHABI32 specification, __cxa_end_cleanup must take care to preserve registers before calling _Unwind_Resume(). So, libcxxrt uses an assembly stub which preserves caller-saved registers around the call to __cxa_get_cleanup(). But: - it failed to restore them properly, - it did not preserve the link register. Fix both of these problems. This is needed to fix exception unwinding on FreeBSD with LLVM 14. Note that r4 is callee-saved but is pushed onto the stack to preserve stack pointer alignment. Sponsored-by: The FreeBSD Foundation MFC after: 1 week
* libcxxrt: Insert padding in __cxa_dependent_exceptionEd Maste2022-04-271-0/+12
| | | | | | | | Padding was added to __cxa_exception in 45ca8b19 and __cxa_dependent_exception needs the same layout. Add some static_asserts to detect this in the future. Merge of libcxxrt commit b00c6c564357
* Merge libcxxrt commit 45ca8b1942090226ba9368caeeeabc0d4ee41ad6Dimitry Andric2022-04-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Insert padding in __cxa_exception struct for compatibility Similar to https://github.com/llvm/llvm-project/commit/f2a436058fcb, the addition of __attribute__((__aligned__)) to _Unwind_Exception (in commit b9616964) causes implicit padding to be inserted before the unwindHeader field in __cxa_exception. Applications attempt to get at the earlier fields in __cxa_exception, so preserve the same negative offsets in __cxa_exception, by moving the padding to the beginning of the struct. The assumption here is that if the ABI is not aware of the padding before unwindHeader and put the referenceCount/primaryException in there, no padding should exist before unwindHeader. This should make libreoffice's custom exception handling mechanisms work correctly, even if it was built against an older cxxabi.h/unwind.h pair. PR: 263370 MFC after: 3 days
* Merge libcxxrt commit f2e55091e2e878386c9f7974d4922bbdc4faed84Dimitry Andric2022-03-201-2/+7
| | | | | | | | | | | | | | Fix unlock in two-word version and add missing comment. Fixes #15 Fixes #16 This should fix the hangs in __cxa_guard_acquire() reported on i386 (and possibly other 32-bit platforms). Obtained from: https://github.com/libcxxrt/libcxxrt/commit/f2e5509 Fixes: 56aaed388b0a MFC after: 2 weeks
* Reapply libcxxrt atomics cleanup commit, preparing for upstream fixDimitry Andric2022-03-204-132/+374
| | | | | | | | | | | | | | | | | This reapplies upstream commit fd484be, as there is a follow-up fix for the possible hangs in __cxa_guard_acquire() on i386: Atomics cleanup (#11) We need to test exception specifiers but they're gone in C++17 so compile the tests with an older version of the standard. Rewrite the guard logic to be more idiomatic C++ and more comprehensible and make sure that atomics are used where necessary. Obtained from: https://github.com/libcxxrt/libcxxrt/commit/fd484be Fixes: 56aaed388b0a MFC after: 2 weeks
* Revert upstream libcxxrt commit which can cause hangs on i386Dimitry Andric2022-03-194-374/+132
| | | | | | | | | | | | | | | | | | | | | This reverts upstream commit fd484be: Atomics cleanup (#11) We need to test exception specifiers but they're gone in C++17 so compile the tests with an older version of the standard. Rewrite the guard logic to be more idiomatic C++ and more comprehensible and make sure that atomics are used where necessary. It looks like there are some corner cases in the i386 and/or 32-bit atomics handling, which can make __cxa_guard_acquire() hang in certain situations. Reported by: antoine Obtained from: https://github.com/libcxxrt/libcxxrt/commit/fd484be Fixes: 56aaed388b0a MFC after: 2 weeks
* Merge libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6Dimitry Andric2022-03-097-154/+475
| | | | | | | | | | Interesting fixes: 47661d0 Match libc++abi/libsupc++ when demangling array types e44a05c Fix unitialized variable in __cxa_demangle_gnu3 after #6 (#8) 5088b05 Remove some code duplication. fd484be Atomics cleanup (#11) MFC after: 2 weeks
* Remove compat hacks from libcxxrt's _Unwind_ExceptionDimitry Andric2022-03-093-28/+13
| | | | | | | | | | | | | | | | | | | This reverts 9097e3cbcac4, which was in itself a revert of upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and a reapplication of our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). The editors/libreoffice port will be patched to be able to cope with the standards-compliant alignment of _Unwind_Exception and consequently, that of __cxa_exception. The layouts and sizes of these structures should then be completely the same for libcxxrt, libunwind and libc++abi. PR: 262008 Reviewed by: emaste, jhb, theraven MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D34488
* Partially revert libcxxrt changes to avoid _Unwind_Exception changeDimitry Andric2021-03-133-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Note I am also applying this to main and stable/13, to restore the old libcxxrt ABI and to avoid having to maintain a compat library.) After the recent cherry-picking of libcxxrt commits 0ee0dbfb0d26 and d2b3fadf2db5, users reported that editors/libreoffice packages from the official package builders did not start anymore. It turns out that the combination of these commits subtly changes the ABI, requiring all applications that depend on internal details of struct _Unwind_Exception (available via unwind-arm.h and unwind-itanium.h) to be recompiled. However, the FreeBSD package builders always use -RELEASE jails, so these still use the old declaration of struct _Unwind_Exception, which is not entirely compatible. In particular, LibreOffice uses this struct in its internal "uno bridge" component, where it attempts to setup its own exception handling mechanism. To fix this incompatibility, go back to the old declarations of struct _Unwind_Exception, and restore the __LP64__ specific workaround we had in place before (which was to cope with yet another, older ABI bug). Effectively, this reverts upstream libcxxrt commits 88bdf6b290da ("Specify double-word alignment for ARM unwind") and b96169641f79 ("Updated Itanium unwind"), and reapplies our commit 3c4fd2463bb2 ("libcxxrt: add padding in __cxa_allocate_* to fix alignment"). PR: 253840
* Fix possibly unitialized variables in __cxa_demangle_gnu3()Dimitry Andric2021-02-221-6/+2
| | | | | | | | | | | | | | After 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 where I imported a more recent libcxxrt snapshot, the variables 'rtn' and 'has_ret' could in some cases be used while still uninitialized. Most obviously this would lead to a jemalloc complaint about a bad free(), aborting the program. Fix this by initializing a bunch variables in their declarations. This change has also been sent upstream, with some additional changes to be used in their testing framework. PR: 253226 MFC after: 3 days
* Revert 3c4fd2463bb2 since upstream libcxxrt fixed it in another wayDimitry Andric2021-02-191-24/+6
| | | | | | | | | | | | | | | | | | | | | | | In 0ee0dbfb0d26cf4bc37f24f12e76c7f532b0f368 I imported a more recent libcxxrt snapshot, which includes an upstream fix for the padding of struct _Unwind_Exception: https://github.com/libcxxrt/libcxxrt/commit/e458560b7e22fff59af643dba363544b393bd8db However, we also had a similar fix in our tree as: https://cgit.freebsd.org/src/commit/?id=3c4fd2463bb29f65ef1404011fcb31e508cdf2e2 Since having both fixes makes the struct too large again, it leads to SIGBUSes when throwing exceptions on amd64 (or other LP64 arches). This is most easily tested by running kyua without any arguments. It looks like our fix is no longer needed now, so revert it to reduce diffs against upstream. PR: 253226 Reviewed by: arichardson, kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28799
* Merge libcxxrt master 8049924686b8414d8e652cbd2a52c763b48e8456Dimitry Andric2021-02-183-7/+20
| | | | | | | | | | Interesting fixes: b3c73ba libelftc_dem_gnu3: Sync with elftoolchain r3877 7b2335c Mostly fix __cxa_demangle after #3 Reported by: arichardson PR: 253226 MFC after: 3 days
* Make vector-related functions in libcxxrt's demangler staticDimitry Andric2020-11-041-9/+9
| | | | | | | | | | | Follow-up to r367323 by re-adding static to a number of the functions copied from elftc's libelftc_vstr.c. This was requested by upstream. PR: 250702 MFC after: 3 days Notes: svn path=/head/; revision=367337
* Update libcxxrt's private copy of elftoolchain demanglerDimitry Andric2020-11-041-389/+816
| | | | | | | | | | | | | This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with the most recent version from upstream r3877. Similar to r367322, this fixes a number of possible assertions, and allows it to correctly demangle several names that it could not handle before. PR: 250702 MFC after: 3 days Notes: svn path=/head/; revision=367323
* Include <stdint.h> in unwind-arm.h, since it uses uint32_t and uint64_tDimitry Andric2019-09-131-0/+3
| | | | | | | | | | | | | in various declarations. Otherwise, depending on how unwind-arm.h is included from other source files, the compiler may complain that uint32_t and uint64_t are unknown types. MFC after: 3 days Notes: svn path=/head/; revision=352306
* Merge libcxxrt master f96846efbfd508f66d91fcbbef5dd808947c7f6d.Dimitry Andric2019-07-262-1/+41
| | | | | | | | | | | | | Interesting fixes: f96846e Fix std::size_t -> size_t to unbreak build against libc++ 6.0.0 6f4cfa2 Fix the uncaught exception count with rethrowing (PR 239265) db54f53 Added C++14-specific operator delete (#47) PR: 239265 MFC after: 3 days Notes: svn path=/head/; revision=350360
* Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.Dimitry Andric2017-03-251-25/+27
| | | | | | | | | | | Interesting fixes which were not already merged: 0c7c611 Merge C++ demangler bug fixes from ELF Tool Chain (#40) 2b208d9 __cxa_demangle_gnu3: demangle 'z' as '...', not 'ellipsis' (#41) MFC after: 3 days Notes: svn path=/head/; revision=315947
* Cherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:Dimitry Andric2017-03-221-9/+1
| | | | | | | | | | | | | | | | | | | | | Author: David Chisnall <theraven@FreeBSD.org> Date: Wed Mar 22 12:27:08 2017 +0000 Simplify some code. realloc() with a null pointer is equivalent to malloc, so we don't need to handle the two cases independently. Fixes #46 This should help with lang/beignet and other programs, which expect __cxa_demangle(name, NULL, NULL, &status) to return zero in status. PR: 213732 MFC after: 3 days Notes: svn path=/head/; revision=315745
* Add _US_ACTION_MASK to libcxxrt's arm-specific unwind header. ThisDimitry Andric2016-09-041-2/+4
| | | | | | | | | value is used in newer versions of compiler-rt. MFC after: 3 days Notes: svn path=/head/; revision=305396
* libcxxrt: fix demangling of wchar_tEd Maste2016-07-271-1/+1
| | | | | | | | | | | | | 'wchar_t' is 7 characters long, not 6. r303297 fixed this in libelftc, but not the second copy of this file that we have in libcxxrt. PR: 208661 Submitted by: Daniel McRobb Obtained from: ELF Tool Chain r3480 MFC after: 3 days Notes: svn path=/head/; revision=303400
* libcxxrt: add padding in __cxa_allocate_* to fix alignmentEd Maste2016-07-211-6/+24
| | | | | | | | | | | | | | | | | | | The addition of the referenceCount to __cxa_allocate_exception put the unwindHeader at offset 0x58 in __cxa_exception, but it requires 16-byte alignment. In order to avoid changing the current __cxa_exception ABI (and thus breaking its consumers), add explicit padding in the allocation routines (and account for it when freeing). This is intended as a lower-risk change for FreeBSD 11. A "more correct" fix should be prepared for upstream and -CURRENT. Reviewed by: dim MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7271 Notes: svn path=/head/; revision=303157
* Import libcxxrt master 516a65c109eb0a01e5e95fbef455eb3215135cef.Dimitry Andric2016-05-052-20/+26
| | | | | | | | | | Interesting fixes: 3adaa2e Fix _Unwind_Exception cleanup functions 286776c Check exception cleanup function ptr before calling edda626 Correct exception specifications on new and delete operators Notes: svn path=/head/; revision=299144
* Compile libcxxrt as C++11, since it is only really used in combinationDimitry Andric2016-03-271-1/+1
| | | | | | | | | | | | | | | with libc++, which is also C++11. Also change one _Static_assert (which is really C11) back into static_assert, like upstream. This should help when compiling libcxxrt with newer versions of gcc, which refuse to recognize any form of static assertions, if not compiling for C++11 or higher. While here, add -nostdinc++ to CFLAGS, to prevent picking up any C++ headers outside the source tree. Notes: svn path=/head/; revision=297299
* Add std::uncaught_exceptions() to libcxxrt (C++17, see N4152 and N4259).Dimitry Andric2015-10-051-0/+9
| | | | | | | This has also been submitted upstream. Notes: svn path=/projects/clang370-import/; revision=288830
* MFV c3ccd112: Correct off-by-ones in free_exception of emergency bufferConrad Meyer2015-09-251-2/+2
| | | | | | | | | | | | | | Note, this has been broken since import in r227825. PR: https://github.com/pathscale/libcxxrt/issues/29 Reviewed by: emaste (earlier version), kan (informally) Obtained from: Anton Rang Relnotes: yes Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3733 Notes: svn path=/head/; revision=288238
* Update libcxxrt upgrade instructionsEd Maste2015-06-181-1/+1
| | | | | | | The typeinfo file no longer exists upstream. Notes: svn path=/head/; revision=284553
* Import libcxxrt master e64e93fe5bba67a6d52cbe5a97f8770c054bfa65.Ed Maste2015-06-181-64/+438
| | | | | | | | | | | This includes a number of demangler fixes obtained from upstream ELF Tool Chain. PR: 200913 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=284551
* Since newer versions of compiler-rt require unwind.h, and we want to useDimitry Andric2015-02-261-0/+2
| | | | | | | | | | | the copy in libcxxrt for it, fix the arm-specific header to define the _Unwind_Action type. Submitted by: andrew MFC after: 3 days Notes: svn path=/head/; revision=279310
* Make libcxxrt's parsing of DWARF exception handling tables work onDimitry Andric2015-02-261-10/+8
| | | | | | | | | | | | | | architectures with strict alignment, by using memcpy() instead of directly reading fields. Reported by: Daisuke Aoyama <aoyama@peach.ne.jp> Reviewed by: imp, bapt Tested by: bapt MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D1967 Notes: svn path=/head/; revision=279307
* Import libcxxrt master 1cb607e89f6135bbc10f3d3b6fba1f983e258dcc.Dimitry Andric2015-01-311-2/+2
| | | | | | | | | | | Interesting fixes: 1cb607e Correct gcc version check for __cxa_begin_catch() declaration with or without throw() MFC after: 3 days Notes: svn path=/head/; revision=278016
* Revert r256642, not only to reduce diffs against upstream libcxxrt, butDimitry Andric2015-01-311-9/+1
| | | | | | | | | | | | | | also because it is the wrong approach: comparing typeinfo names deeply causes trouble if two loaded DSOs use independent types of the same name. In addition, this particular change was never merged to FreeBSD 10.x and 9.x, so let's get rid of it before it ends up in an 11.x release. Discussed with: theraven, joerg@netbsd Notes: svn path=/head/; revision=278010
* Partially revert r273382, to reduce diffs against upstream. This was aDimitry Andric2015-01-301-5/+0
| | | | | | | | | | temporary fix to solve a conflict with an older version of libc++, and it is no longer relevant. MFC after: 3 days Notes: svn path=/head/; revision=277944
* Import libcxxrt master 00bc29eb6513624824a6d7db2ebc768a4216a604.Dimitry Andric2014-12-3011-136/+192
| | | | | | | | | | | | | Interesting fixes: 76584a0 Reorganize code to use only 32bit atomic ops for 32bit platforms 30d2ae5 Implement __cxa_throw_bad_array_new_length Reviewed by: bapt MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D1390 Notes: svn path=/head/; revision=276417
* Fix build by marking the new functions as weakBaptiste Daroussin2014-10-211-0/+10
| | | | | | | This is a temporary fix Notes: svn path=/head/; revision=273382
* Add support for __cxa_throw_bad_array_new_length in libcxxrtBaptiste Daroussin2014-10-213-0/+22
| | | | | | | | | | | | It is required for use with newer g++49 Differential Revision: https://reviews.freebsd.org/D982 Reviewed by: theraven Approved by: theraven MFC after: 3 weeks Notes: svn path=/head/; revision=273381
* Pull in upstream libcxxrt commit 8006101, which makes its cxxabi.h fileDimitry Andric2014-02-071-0/+1
| | | | | | | | | | compilable just by itself. PR: kern/184019 MFC after: 3 days Notes: svn path=/head/; revision=261609
* Since C++ typeinfo objects are currently not guaranteed to be merged atDimitry Andric2013-10-161-1/+9
| | | | | | | | | | | | | | runtime by the dynamic linker, check for their equality in libcxxrt by not only comparing the typeinfo's name pointers, but also comparing the full names, if necessary. (This is similar to what GNU libstdc++ does in its default configuration.) The 'deep' check can be turned off again by defining LIBCXXRT_MERGED_TYPEINFO, and recompiling libcxxrt. Reviewed by: theraven MFC after: 3 days Notes: svn path=/head/; revision=256642
* Import a new libcxxrt. This fixes some potential crashing in the demangler.David Chisnall2013-09-233-17/+74
| | | | | | | | Approved by: re (gjb) MFC after: 1 week Notes: svn path=/head/; revision=255815
* Don't use _Unwind_Backtrace() on ARM as it's currently missing from our ↵David Chisnall2013-08-311-0/+2
| | | | | | | libgcc_s. andrew@ has patches to add it, so this can be reverted and sync'd with upstream later. Notes: svn path=/head/; revision=255093
* Remove __attribute__((__aligned__)) that generates incorrect alignment on ↵David Chisnall2013-08-071-1/+1
| | | | | | | compilers that know about SSE. Code left over from old header that thought that 64 bits was the maximum alignment that anything would ever need... Notes: svn path=/head/; revision=254057
* Import new libcxxrt / libc++. This brings some bug fixes, including a ↵David Chisnall2013-07-107-121/+138
| | | | | | | potential race condition for static initialisers. Notes: svn path=/head/; revision=253159
* Merge libcxxrt c812a07cd2f95c1403baf0bbe0366e7618d1d6d3:Dimitry Andric2013-04-272-4/+4
| | | | | | | | | | | | | | | | * Don't call the _fast version of the TLS accessor in terminate() or unexpected(). 1) TLS may not have been set up yet. 2) When we're in one of these functions, Really Bad Stuff has happened and potentially saving a few cycles really isn't important. * Merge in fixes from FreeBSD trunk to make atomics work with recent clang. MFC after: 1 week Notes: svn path=/head/; revision=249993
* Fix a copy-and-paste error in libcxxrt.David Chisnall2013-02-071-1/+1
| | | | Notes: svn path=/head/; revision=246462
* Import new fix from libcxxrt. This fixes the case where you attempt to rethrowDavid Chisnall2013-01-211-1/+1
| | | | | | | | | | | an exception when you haven't caught one. This is largely a cosmetic fix, as (unless you have a very unusual terminate handler installed) it will print a nice error and then abort, rather than just aborting. MFC after: 7 days Notes: svn path=/head/; revision=245745
* Fix libcxxrt / libc++ build with the clang in head.David Chisnall2013-01-121-2/+2
| | | | | | | Pointy hat to: theraven Notes: svn path=/head/; revision=245327
* Merge new version of libcxxrt. This brings in three fixes:David Chisnall2013-01-114-34/+132
| | | | | | | | | | | | | - Don't treat pointers to members as pointers in catch blocks (they're usually fat pointers). - Correctly catch foreign exceptions in catchalls. - Ensure that a happens-before relationship is established when setting terminate handlers in one thread and calling them in another. Notes: svn path=/head/; revision=245304
* Import new version of libcxxrt. Now works correctly with libobjc2 to implementDavid Chisnall2012-03-204-105/+182
| | | | | | | | | the unified exception model for Objective-C++. Approved by: dim (mentor) Notes: svn path=/head/; revision=233235