Commit Graph

194 Commits

Author SHA1 Message Date
Eric Fiselier 096d636a35 Fix PR25874 - cxa_thread_atexit_test.pass.cpp has an incorrect XFAIL.
llvm-svn: 300925
2017-04-20 23:40:35 +00:00
Asiri Rathnayake 4cc78d7008 Fix exception address alignment test for EHABI
This test fails on ARM bare-metal targets because it assumes the Itanium ABI,
whereas EHABI requires the exception address to be 8-byte aligned.

I was a bit puzzled at first because this should've failed on the public
arm-linux builder too. I think the reason it passes there is because we don't
include libunwind headers in the include path when running the libcxxabi tests,
so the system unwind.h gets picked up.

Reviewers: rengolin, EricWF
Differential revision: https://reviews.llvm.org/D31178

llvm-svn: 299435
2017-04-04 14:03:54 +00:00
Shoaib Meenai a40507574e [libc++abi] Delete config.h
Summary: It's now completely empty, so we can remove it entirely.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D31502

llvm-svn: 299129
2017-03-30 23:31:33 +00:00
Eric Fiselier f4313ebfef Add missing UNSUPPORTED for -fno-exception mode
llvm-svn: 296957
2017-03-04 03:03:27 +00:00
Eric Fiselier d532ddcce9 Attempt to suppress test failures on OS X
llvm-svn: 296955
2017-03-04 02:29:25 +00:00
Eric Fiselier c74a2e1297 [libcxxabi] Fix alignment of allocated exceptions in 32 bit builds
Summary:
In 32 bit builds on a 64 bit system `std::malloc` does not return correctly aligned memory.  This leads to undefined behavior.

This patch switches to using `posix_memalign` to allocate correctly aligned memory instead.

Reviewers: mclow.lists, danalbert, jroelofs, compnerd

Reviewed By: compnerd

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25417

llvm-svn: 296952
2017-03-04 02:04:45 +00:00
Eric Fiselier afa6f9793a Fix PR25874 - Detect features required for cxa_thread_atexit_test.pass.cpp
llvm-svn: 296940
2017-03-04 01:26:41 +00:00
Asiri Rathnayake 0b59cf64a0 Attempt to fix arm-native libcxxabi tests for the no-exceptions variant
These tests embed calls to exceptions-related symbols from the abi library,
which are absent in the no-exceptions variant. The tests need to be marked
as unsupported for the no-exceptions configuration.

llvm-svn: 296344
2017-02-27 15:31:34 +00:00
Eric Fiselier 1cb33118d9 Fix test_exception_storage.pass.cpp in C++17 my re-enabling the unexpected handlers
llvm-svn: 295411
2017-02-17 04:26:22 +00:00
Eric Fiselier 11306e5113 Fix path to libc++'s python test module
llvm-svn: 294671
2017-02-09 23:58:54 +00:00
David Bozier ec78fd11ca Add support for demangling C++11 thread_local variables. In clang, the grammar for mangling for these names are "<special-name> ::= TW <object name>" for wrapper variables or "<special-name> ::= TH <object name>" for initialization variables.
llvm-svn: 293638
2017-01-31 15:18:56 +00:00
Mehdi Amini 453ab3522b Fix ASAN failure in cxa_demangle
Found with ASAN + libFuzzer by Kostya Serebryany <kcc@google.com>

llvm-svn: 293330
2017-01-27 20:32:16 +00:00
Saleem Abdulrasool f5d26bb142 cxa_demangle: fix rvalue ref check
When checking if the type is a r-value ref, we would not do a complete
check.  This would result in us treating a trailing parameter reference
`&)` as a r-value ref, and improperly inject the cv qualifier on the
type.  We now correctly demangle the type `KFvRmE` as a constant
function rather than a constant reference.

Fixes PR31741!

llvm-svn: 292973
2017-01-24 19:57:05 +00:00
Saleem Abdulrasool 0c44db8f0a cxa_demangle: avoid butchering the last parameter type
Fix an off-by-one case which would destroy the final parameter in a
CV-qualified function type with a reference.  We still get the CV
qualification incorrect, but at least we do not clobber the type name
any longer.

Partially fixes PR31741.

llvm-svn: 292963
2017-01-24 18:42:56 +00:00
Eric Fiselier 5aeb880d90 Remove all usages of REQUIRES-ANY in the test suite.
Pending LIT changes are about to remove the REQUIRES-ANY keyword
in place of supporting boolean && and || within "REQUIRES". This
patch prepares libc++ for that change so that when applied
the bots don't lose their mind.

llvm-svn: 292906
2017-01-24 10:28:23 +00:00
Eric Fiselier 35c8983c33 Fix catch_reference_nullptr.pass.cpp test for GCC.
This test contained an implicit conversion from nullptr to bool.
Clang warns about this but the test had supressed that warning.
However GCC diagnoses the same code as an error and requires
-fpermissive to accept it.

This patch fixes both the warning and the error by explicitly
converting the pointer to bool.

llvm-svn: 292638
2017-01-20 19:34:19 +00:00
Jonathan Roelofs 8829e961e6 Revert r286788
The Itanium ABI [1] specifies that __cxa_demangle accept either:

   1) symbol names, which start with "_Z"
   2) type manglings, which do not start with "_Z"

r286788 erroneously assumes that it should only handle symbols, so this patch
reverts it and adds a counterexample to the testcase.

1: https://mentorembedded.github.io/cxx-abi/abi.html#demangler


Reviewers: zygoloid, EricWF
llvm-svn: 292418
2017-01-18 18:12:39 +00:00
Marshall Clow b4a2a63373 Mark the dynamic-exception tests as unsupported under C++17, since it has no dynamic-exception specs. Also, remove a FIXME workaround from the config that allowed these tests to work under C++17. This addresses PR#31621.
llvm-svn: 292135
2017-01-16 15:28:03 +00:00
Asiri Rathnayake a573fe25e6 [libcxxabi] Cleanup and adapt for r291275. NFC.
+ Now that libcxxabi shares the same threading API as libcxx, a whole
  chunk of code in src/config.h is made redundant (I missed this earlier).

+ r291275 split off the externalized-thread-api libcxx configuration from the
  external-thread-library libcxx configuration. libcxxabi should follow the
  same approach.

llvm-svn: 291440
2017-01-09 11:57:21 +00:00
Asiri Rathnayake 97ba9fae1f [libcxxabi] Introduce an externally threaded libc++abi variant.
r281179 Introduced an externally threaded variant of the libc++ library. This
patch adds support for a similar library variant for libc++abi.

Differential revision: https://reviews.llvm.org/D27575

Reviewers: EricWF
llvm-svn: 290888
2017-01-03 12:58:34 +00:00
Eric Fiselier 47570b8d2c Suppress unreachable code warning in unwind tests
llvm-svn: 290487
2016-12-24 05:01:55 +00:00
Eric Fiselier a140cba795 Fix warnings in libc++abi tests
llvm-svn: 290471
2016-12-24 00:37:13 +00:00
Shoaib Meenai 5723c4f4c2 [libc++abi] Mark failing test on Darwin as XFAIL
The macOS thread-local variable finalizer routines do not handle the
case where a termination function registers another termination function
correctly, causing this test to fail. I've filed a radar for this;
mark the test XFAIL in the meantime. See [1] for more details.

[1] http://lists.llvm.org/pipermail/cfe-dev/2016-November/051376.html

Differential Revision: https://reviews.llvm.org/D27434

llvm-svn: 289513
2016-12-13 02:43:04 +00:00
Eric Fiselier 2f179bd85b Fix signed comparison warning
llvm-svn: 289365
2016-12-11 05:43:20 +00:00
Eric Fiselier 58f4a59731 Workaround the removal of dynamic exception specifications in C++17
llvm-svn: 289353
2016-12-11 01:35:55 +00:00
Richard Smith 366bb54f81 Check for SD-6 feature test macro when determining which tests should be
available, rather than #ifdef'ing away the relevant tests if it's unavailable.

llvm-svn: 288543
2016-12-02 22:14:59 +00:00
Richard Smith cc2d21111d Fix up r288457 for compilers that don't support noexcept function types:
disable the test entirely for those cases. This is a quick patch, I'll look at
a proper feature flag next.

llvm-svn: 288539
2016-12-02 21:43:36 +00:00
Richard Smith 6afcab3588 Update implementation of ABI support for throwing noexcept function pointers
and catching as non-noexcept to match the final design per discusson on
cxx-abi-dev.

llvm-svn: 288457
2016-12-02 02:06:53 +00:00
Saleem Abdulrasool 4d7f90b064 __cxa_demangle: allow demangling invocation blocks
The block invocation function uses an extension where the prefix is ___Z
as opposed to _Z.  This should make the tests pass again.

Disable a negative test which was testing a crasher.  The symbol being
demangled is not a valid mangled symbol and will return a nullptr.

Adjust the type info decoding test to be a valid symbol name.

llvm-svn: 286793
2016-11-14 03:07:47 +00:00
Eric Fiselier 79ff8f0375 Fix GCC libc++abi build
llvm-svn: 286783
2016-11-13 22:27:00 +00:00
Logan Chien 22012a5973 arm: Fix ttype encoding assertion failure.
GCC 4.7 or newer emits 0x90 (indirect | pcrel) as the ttype encoding.
This would hit an assertion in cxa_personality.cpp.  This commit fixes
the problem by relaxing the assertion.

llvm-svn: 286760
2016-11-13 14:44:41 +00:00
Igor Kudrin d7407628cc [libc++abi] Remove the test for checking using of fallback malloc in case of dynamic memory exhaustion.
This test is too fragile and doesn't add significant value. See https://reviews.llvm.org/D26150 for some details.

llvm-svn: 286337
2016-11-09 04:14:31 +00:00
Richard Smith 80b64f0861 [p0012] Implement ABI support for throwing a noexcept function pointer and
catching as non-noexcept

This implements the following proposal from cxx-abi-dev:

http://sourcerytools.com/pipermail/cxx-abi-dev/2016-October/002988.html

... which is necessary for complete support of http://wg21.link/p0012,
specifically throwing noexcept function and member function pointers and
catching them as non-noexcept pointers.

Differential Review: https://reviews.llvm.org/D26178

llvm-svn: 285867
2016-11-02 23:41:51 +00:00
Eric Fiselier 82a1fc8db6 Spell libcxxabi-no-threads correctly
llvm-svn: 285571
2016-10-31 14:14:04 +00:00
Eric Fiselier 2d4fbb7b0c Mark thread exit test as unsupported w/o threads
llvm-svn: 285523
2016-10-30 20:05:52 +00:00
Eric Fiselier ccc6502abc Mark test as unsupported without threads
llvm-svn: 284217
2016-10-14 09:12:53 +00:00
Asiri Rathnayake 6d3ea6831d [libcxxabi] Refactor pthread usage into a separate API
This patch refactors all pthread uses of libc++abi into a separate API. This
is the first step towards supporting an externlly-threaded libc++abi library.

I've followed the conventions already used in the libc++ library for the same
purpose.

Patch from: Saleem Abdulrasool and Asiri Rathnayake

Reviewed by: compnerd, EricWF

Differential revisions:
  https://reviews.llvm.org/D18482 (original)
  https://reviews.llvm.org/D24864 (final)

llvm-svn: 284128
2016-10-13 15:05:19 +00:00
Eric Fiselier 829c0eab91 Provide a fallback __cxa_thread_atexit() implementation. Patch from Tavian Barnes
llvm-svn: 283988
2016-10-12 08:54:10 +00:00
Eric Fiselier c3dc89e4ab Fix libc++abi test config after recent libc++ changes
llvm-svn: 283962
2016-10-12 01:19:16 +00:00
Igor Kudrin d9edde4ae2 Recommit r282692: [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.
Throwing an exception for the first time may lead to call calloc to
allocate memory for __cxa_eh_globals. If the memory pool is exhausted
at that moment, it results in abnormal termination of the program.

This patch addresses the issue by using fallback_malloc in that case.

In this revision, some restrictions were added into the test to not
run it in unsuitable environments.

Differential Revision: https://reviews.llvm.org/D17815

llvm-svn: 283531
2016-10-07 08:48:28 +00:00
Igor Kudrin 49df799762 Revert r282692: Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.
The test breaks build bots.

llvm-svn: 282703
2016-09-29 08:11:57 +00:00
Igor Kudrin 962750b511 [libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.
Throwing an exception for the first time may lead to call calloc to
allocate memory for __cxa_eh_globals. If the memory pool is exhausted
at that moment, it results in abnormal termination of the program.

This patch addresses the issue by using fallback_malloc in that case.

Differential Revision: https://reviews.llvm.org/D17815

llvm-svn: 282692
2016-09-29 06:38:06 +00:00
Asiri Rathnayake 7c98baab29 [libcxxabi] cleanup the use of LIBCXXABI_HAS_NO_THREADS macro (NFC)
Align the naming / use of the macro LIBCXXABI_HAS_NO_THREADS to follow what we
have in libcxx. NFC.

llvm-svn: 282062
2016-09-21 09:09:32 +00:00
Eric Fiselier b4e15b8cee Fix side effect in assertion
llvm-svn: 281709
2016-09-16 08:16:07 +00:00
Logan Chien 7a78e5113a [lit] Replace print with lit_config.note().
This commit replaces print statement with lit_config.note().  This fixes
python3 support for check-libcxxabi.

llvm-svn: 280484
2016-09-02 13:56:05 +00:00
Eric Fiselier 36ca35f505 [CMake] Be more consistent about naming targets and components in libc++abi
This patch (and commit summary) mirror r279675 by Chris B which was applied
to libc++ but not libc++abi.

Summary:
The point of this patch is to have a consistent convention for naming build,
check and install targets so that the targets can be constructed from the
project name.

This change renames a bunch of CMake components and targets from libcxxabi to
cxxabi. For each renamed target I've added a convenience target that matches
the old target name and depends on the new target. This will preserve function
of the old targets so that the change doesn't break the world. We can evaluate
if it is worth removing the extra targets later.

llvm-svn: 279938
2016-08-28 18:28:51 +00:00
Eric Fiselier 4b3308c27f [CMake] Apply r279151 cleanup to libc++abi.
This patch applies changes similar to those in r279515 to libc++abi.

Summary of changes in this patch:

* Renamed variable LLVM_CONFIG -> LLVM_CONFIG_PATH
* Renamed variable LIBCXXABI_BUILT_STANDALONE -> LIBCXXABI_STANDALONE_BUILD
* Add an include of AddLLVM in the tests subdirectory for add_lit_testsuite.

llvm-svn: 279936
2016-08-28 18:16:18 +00:00
Saleem Abdulrasool 0b7b36a9dd test: fix test under ASAN and MSAN
When we're running tests under ASAN or MSAN, they're compiled with -O1, which
enables tail call elimination. This causes backtrace_test to fail: the compiler
performs tail call elimination for call3_nothrow, but it can't for call3_throw,
leading to a mismatched frame count. Disable tail call elimination (and
inlining, just to be explicit) to avoid this.

Patch by Shoaib Meenai!

llvm-svn: 279935
2016-08-28 18:16:00 +00:00
Mehdi Amini 4d03572c14 Fix ASAN failures in the demangler
These were found fuzzing with ASAN.

llvm-svn: 278579
2016-08-13 00:02:33 +00:00
Petr Hosek daee3be364 Do not depend on unwind when building standalone
When libcxxabi is being built standalone, unwind dependency is not
available, so do not use it even when LLVM unwinder is being
requested.

Differential Revision: https://reviews.llvm.org/D23228

llvm-svn: 278058
2016-08-08 22:09:54 +00:00