Commit Graph

33 Commits

Author SHA1 Message Date
Dimitry Andric
2d23488dac Cherry-pick libcxxrt commit 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92:
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
2017-03-22 21:45:42 +00:00
Dimitry Andric
8795828371 Add _US_ACTION_MASK to libcxxrt's arm-specific unwind header. This
value is used in newer versions of compiler-rt.

MFC after:	3 days
2016-09-04 21:48:58 +00:00
Ed Maste
0fe768778d libcxxrt: fix demangling of wchar_t
'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
2016-07-27 17:18:08 +00:00
Ed Maste
3c4fd2463b libcxxrt: add padding in __cxa_allocate_* to fix alignment
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
2016-07-21 18:20:35 +00:00
Dimitry Andric
076e75ebe4 Import libcxxrt master 516a65c109eb0a01e5e95fbef455eb3215135cef.
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
2016-05-05 22:40:07 +00:00
Dimitry Andric
35b9ea3d09 Compile libcxxrt as C++11, since it is only really used in combination
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.
2016-03-27 00:37:54 +00:00
Dimitry Andric
bb52ed3249 Add std::uncaught_exceptions() to libcxxrt (C++17, see N4152 and N4259).
This has also been submitted upstream.
2015-10-05 17:47:23 +00:00
Conrad Meyer
76ad56672b MFV c3ccd112: Correct off-by-ones in free_exception of emergency buffer
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
2015-09-25 22:29:21 +00:00
Ed Maste
f66e4b93b7 Update libcxxrt upgrade instructions
The typeinfo file no longer exists upstream.
2015-06-18 14:29:46 +00:00
Ed Maste
fa7477cef3 Import libcxxrt master e64e93fe5bba67a6d52cbe5a97f8770c054bfa65.
This includes a number of demangler fixes obtained from upstream
ELF Tool Chain.

PR:		200913
Sponsored by:	The FreeBSD Foundation
2015-06-18 14:12:08 +00:00
Dimitry Andric
fb48e1d39c Since newer versions of compiler-rt require unwind.h, and we want to use
the copy in libcxxrt for it, fix the arm-specific header to define the
_Unwind_Action type.

Submitted by:	andrew
MFC after:	3 days
2015-02-26 07:42:16 +00:00
Dimitry Andric
a0f4b91bed Make libcxxrt's parsing of DWARF exception handling tables work on
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
2015-02-26 07:20:05 +00:00
Dimitry Andric
07122a2a31 Import libcxxrt master 1cb607e89f6135bbc10f3d3b6fba1f983e258dcc.
Interesting fixes:
1cb607e	Correct gcc version check for __cxa_begin_catch() declaration
	with or without throw()

MFC after:	3 days
2015-01-31 23:31:45 +00:00
Dimitry Andric
4bf41ce2a6 Revert r256642, not only to reduce diffs against upstream libcxxrt, but
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
2015-01-31 23:08:29 +00:00
Dimitry Andric
09a4a1f2d8 Partially revert r273382, to reduce diffs against upstream. This was a
temporary fix to solve a conflict with an older version of libc++, and
it is no longer relevant.

MFC after:	3 days
2015-01-30 18:26:38 +00:00
Dimitry Andric
f2dc4184d2 Import libcxxrt master 00bc29eb6513624824a6d7db2ebc768a4216a604.
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
2014-12-30 20:01:06 +00:00
Baptiste Daroussin
1418fbd6c7 Fix build by marking the new functions as weak
This is a temporary fix
2014-10-21 12:52:01 +00:00
Baptiste Daroussin
726f4cd580 Add support for __cxa_throw_bad_array_new_length in libcxxrt
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
2014-10-21 10:19:45 +00:00
Dimitry Andric
f18dc6922d Pull in upstream libcxxrt commit 8006101, which makes its cxxabi.h file
compilable just by itself.

PR:		kern/184019
MFC after:	3 days
2014-02-07 21:34:09 +00:00
Dimitry Andric
04461e6012 Since C++ typeinfo objects are currently not guaranteed to be merged at
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
2013-10-16 17:00:21 +00:00
David Chisnall
0f9eee39f0 Import a new libcxxrt. This fixes some potential crashing in the demangler.
Approved by:	re (gjb)
MFC after:	1 week
2013-09-23 13:16:21 +00:00
David Chisnall
26b8b75c54 Don't use _Unwind_Backtrace() on ARM as it's currently missing from our libgcc_s. andrew@ has patches to add it, so this can be reverted and sync'd with upstream later. 2013-08-31 08:56:33 +00:00
David Chisnall
02e4f2a3a4 Remove __attribute__((__aligned__)) that generates incorrect alignment on 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... 2013-08-07 11:30:04 +00:00
David Chisnall
4bab9fd964 Import new libcxxrt / libc++. This brings some bug fixes, including a potential race condition for static initialisers. 2013-07-10 16:28:24 +00:00
Dimitry Andric
d9e22925e0 Merge libcxxrt c812a07cd2f95c1403baf0bbe0366e7618d1d6d3:
* 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
2013-04-27 19:26:56 +00:00
David Chisnall
fe9b3289e6 Fix a copy-and-paste error in libcxxrt. 2013-02-07 11:08:03 +00:00
David Chisnall
d5861eaae8 Import new fix from libcxxrt. This fixes the case where you attempt to rethrow
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
2013-01-21 17:37:23 +00:00
David Chisnall
f795bc7ccc Fix libcxxrt / libc++ build with the clang in head.
Pointy hat to:	theraven
2013-01-12 10:06:59 +00:00
David Chisnall
f7cb16572f Merge new version of libcxxrt. This brings in three fixes:
- 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.
2013-01-11 15:05:55 +00:00
David Chisnall
c725650d64 Import new version of libcxxrt. Now works correctly with libobjc2 to implement
the unified exception model for Objective-C++.

Approved by:	dim (mentor)
2012-03-20 17:58:15 +00:00
David Chisnall
94e3ee44c3 Import new versions of libcxxrt and libc++.
Please tests any C++ code you care about with -stdlib=libc++!

Approved by:	dim (mentor)
2012-03-14 00:09:36 +00:00
David Chisnall
db47c4bf21 Update libcxxrt to remove the pthread dependency.
Also add the license from upstream to contrib.

Approved by:	dim (mentor)
2011-11-26 18:46:33 +00:00
David Chisnall
7a98470824 Import libc++ / libcxxrt into base. Not build by default yet (use
MK_LIBCPLUSPLUS=yes to enable).  This is a work-in-progress.  It works for
me, but is not guaranteed to work for anyone else and may eat your dog.

To build C++ using libc++, add -stdlib=libc++ to your CXX and LD flags.

Bug reports welcome, bug fixes even more welcome...

Approved by:	dim (mentor)
2011-11-25 20:59:04 +00:00