After 0ee0dbfb0d 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
In 0ee0dbfb0d I imported a more recent
libcxxrt snapshot, which includes an upstream fix for the padding of
struct _Unwind_Exception:
e458560b7e
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
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
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
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
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
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
'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
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
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
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.
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
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
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
* 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
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
- 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.
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)