Commit Graph

172 Commits

Author SHA1 Message Date
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
Richard Smith 398d9c0c4a Attempt to bring peace to -Werror buildbots.
llvm-svn: 276022
2016-07-19 20:35:09 +00:00
Richard Smith 2f984cab4f [libcxxabi] When catching an exception of type nullptr_t with a handler of
pointer-to-member type, produce a null value of the right type.

This fixes a bug where throwing an exception of type nullptr_t and catching it
as a pointer-to-member would not guarantee to produce a null value in the catch
handler. The fix is pretty simple: we statically allocate a constant null
pointer-to-data-member representation and a constant null
pointer-to-member-function representation, and produce the address of the
relevant value as the adjusted pointer for the exception.

llvm-svn: 276016
2016-07-19 20:19:37 +00:00
Eric Fiselier d1804db966 Fix [libcxxabi] Fix warning about uninitialized const member.
llvm-svn: 272824
2016-06-15 19:59:16 +00:00
Eric Fiselier 567b755b7c Fix warning about uninitialized const member. NFC
llvm-svn: 272823
2016-06-15 19:48:26 +00:00
Eric Fiselier 78621e4076 [libcxxabi] Reorder base class initializers in libc++abi tests to prevent -Wreorder
Summary:
This patch fixes -Wreorder warnings on test classes with virtual bases. Since the compiler is performing the reordering anyway this change *should* have NFC.

However the test notes that it is checking that "virtual base classes work properly". Since initialization order is clearly part of correctness I want to confirm that this wasn't an intentional mistake.



Reviewers: mclow.lists, howard.hinnant

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21396

llvm-svn: 272821
2016-06-15 19:33:01 +00:00
Eric Fiselier f5ff11c432 Suppress warnings about the operations currently under test.
llvm-svn: 272819
2016-06-15 19:07:19 +00:00
Eric Fiselier ffd1893df5 [libcxxabi] Allow target flags to affect configuration tests.
Summary:
This patch changes the libc++abi CMake so that it adds certain target flags like  '-m32' or '--gcc-toolchain' before including `config-ix.cmake`.
Since these flags can affect things like `check_library_exists([...])` they needed to be added before the tests are performed.

Additionally this patch adds `LIBCXXABI_BUILD_32_BITS` which defaults to `LLVM_BUILD_32_BITS`.

This patch fixes:

https://llvm.org/bugs/show_bug.cgi?id=27950
https://llvm.org/bugs/show_bug.cgi?id=27959

Reviewers: danalbert, jroelofs, bcraig, compnerd, EricWF

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D20886

llvm-svn: 271470
2016-06-02 02:18:31 +00:00
Asiri Rathnayake ece18f4c14 [libcxxabi][test] Add missing return statement.
This causes a test failure when running with -Werror=return-type.

NFC.

llvm-svn: 271423
2016-06-01 19:13:53 +00:00
Asiri Rathnayake 57e446dafa [libcxxabi] Introduce a -fno-exceptions libc++abi libary variant
Currently there is only support for a -fno-exceptions libc++ build. This is
problematic for functions such as std::terminate() which are defined in
libc++abi and using any of those functions throws away most of the benefits
of using -fno-exceptions (code-size). This patch introduces a -fno-exceptions
libc++abi build to address this issue.

This new variant of libc++abi cannot be linked against any with-exceptions
code as some symbols necessary for handling exceptions are missing in this
library.

Differential revision: http://reviews.llvm.org/D20677

Reviewers: EricWF, mclow.lists, bcraig
llvm-svn: 271267
2016-05-31 12:01:32 +00:00
Ben Craig e9fdfd868a Enable testing for static libc++abi
This change leverages framework changes made in libcxx. See those changes for
more details. (http://reviews.llvm.org/D16544)

Some Mac specific logic for testing against libc++abi had to be moved from
libcxxabi's config.py, as it was overriding choices made in libcxx's config.py.
That logic is now in libcxx's target_info.py.

http://reviews.llvm.org/D16545

llvm-svn: 266729
2016-04-19 12:47:38 +00:00
Jonas Hahnfeld 626557be6b [libcxxabi] Disable cxa_thread_atexit_test if unavailable
The feature check is already in place when building the library but wasn't
honored for the tests.

Differential Revision: http://reviews.llvm.org/D18205

llvm-svn: 263699
2016-03-17 10:00:24 +00:00
Ben Craig 5d78477ba1 Reducing stack usage of test
This test has a lot of classes with large amounts of manually inserted padding in them, presumably to prevent various optimizations. The test then creates lots of these objects on the stack. On embedded targets, this was usually enough to overflow the stack.

I moved the objects to global / namespace scope. Since the tests are each in their own namespace, there should be no cross-test conflicts.

llvm-svn: 262717
2016-03-04 14:25:13 +00:00
Ben Craig a6dc36f65e [libcxxabi] Make test tolerant of uncommon floating literal demanglings
libcxxabi uses the C99 library's %a format specifier to turn a floating
point value into a hexadecimal string representation. The %a format
specifier is rather loosely defined in the C spec though, and some C
libraries emit a different (but valid) string for a given floating
point value. In particular, the C spec only requires that there is a
single, non-zero hexadecimal digit on the left of the decimal point.
Given that constraint, there are typically four different valid 
representations of a floating point number. I have updated the test to
accept any of the valid representations for demangled floating
point literals.

llvm-svn: 258311
2016-01-20 14:03:27 +00:00
Eric Fiselier 3f7c20747d Mark some tests as XFAIL with GCC due to compiler bugs
llvm-svn: 258284
2016-01-20 04:06:46 +00:00
Eric Fiselier 203655a936 Fix link flags order in RUN command.
llvm-svn: 258277
2016-01-20 03:04:50 +00:00
Eric Fiselier 6f630f800b Recommit r256322: Fix PR25898 - Check for incomplete pointers types in can_catch(...)
This patch re-commits r256322 and r256323. They were reverted due to a OS X
test failure. The test failure has been fixed by libc++ commit r258217.

This patch also adds some additional tests.

llvm-svn: 258249
2016-01-19 23:42:10 +00:00
Eric Fiselier 58ad9b19cc Add missing license headers
llvm-svn: 258201
2016-01-19 22:07:10 +00:00
Nico Weber 6977ee7f4c Revert r256322 (and follow-up 256323), the test it added does not pass on OS X.
llvm-svn: 257896
2016-01-15 15:44:14 +00:00
Eric Fiselier dfe216dba8 Add new tests for throwing incomplete pointer types
llvm-svn: 256323
2015-12-23 07:04:32 +00:00
Eric Fiselier 88b26886b2 Fix PR25898 - Check for incomplete pointers types in can_catch(...)
llvm-svn: 256322
2015-12-23 06:35:25 +00:00
Eric Fiselier 3cf3cfc4c5 Fix LIBCXXABI_HAS_NO_THREADS configuration.
llvm-svn: 250316
2015-10-14 19:21:38 +00:00
Eric Fiselier 035ddc2046 Configure for config site header
llvm-svn: 250313
2015-10-14 19:01:47 +00:00