Commit Graph

632 Commits

Author SHA1 Message Date
Martell Malone 53877bc5b9 [Libcxxabi]: Support using compiler-rt for MinGW64
Reviewers: EricWF

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

llvm-svn: 302824
2017-05-11 21:16:29 +00:00
Akira Hatanaka 5662e55de5 Revert "[libcxxabi] Align unwindHeader on a double-word boundary."
This reverts commit r302763.

The commit caused bot failures.

llvm-svn: 302764
2017-05-11 06:17:49 +00:00
Akira Hatanaka a9bbdc507c [libcxxabi] Align unwindHeader on a double-word boundary.
r276215 made a change to annotate _Unwind_Exception with attribute
"aligned" so that an exception object following field __cxa_exception
is sufficiently aligned. This fix hasn't been incorporated to unwind.h
on Darwin since it is an ABI breaking change.

Instead of annotating struct _Unwind_Exception with the attribute, this
commit annotates field unwindHeader of __cxa_exception. This ensures the
exception object is sufficiently aligned without breaking the ABI.

rdar://problem/25364625

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

llvm-svn: 302763
2017-05-11 05:58:52 +00:00
Eric Fiselier 6c3eb5fe0e Revert "Rename c++abi.a on Windows to libc++abi to avoid name conflicts"
This reverts commit r302759

llvm-svn: 302762
2017-05-11 05:05:06 +00:00
Eric Fiselier 70c2b1c551 Allow undefined symbols when linking libc++abi.dll on Windows
llvm-svn: 302761
2017-05-11 03:49:48 +00:00
Eric Fiselier accba012b4 Fix Libc++abi linking under MinGW64
llvm-svn: 302760
2017-05-11 03:29:59 +00:00
Eric Fiselier 144019ac22 Rename c++abi.a on Windows to libc++abi to avoid name conflicts
llvm-svn: 302759
2017-05-11 03:18:29 +00:00
Eric Fiselier 9226279daa Don't use posix_memalign under MinGW
llvm-svn: 302755
2017-05-11 02:01:05 +00:00
Eric Fiselier f57d5d08ba Apply libc++ MinGW CMake fix to libc++abi
llvm-svn: 302754
2017-05-11 02:00:25 +00:00
Shoaib Meenai f43726cd22 [libc++abi] Disable libc++ extern templates project-wide
libc++abi can't depend on libc++, so disable extern templates in libc++
headers project-wide. This was previously done in cxa_demangle.cpp, but
I consider it more appropriate to do at the cmake level (since none of
libc++abi's source files can use libc++ extern templates).

I also think the _LIBCPP_NO_EXCEPTIONS in cxa_demangle.cpp is
suspicious, but I'm doing one thing at a time.

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

llvm-svn: 302739
2017-05-10 21:52:39 +00:00
Eric Fiselier daffb57605 Fix use of now removed %exec test substitution
llvm-svn: 302698
2017-05-10 17:52:53 +00:00
Eric Fiselier 3ab4600c1e Fix use of removed SH test replacement %exec
llvm-svn: 302629
2017-05-10 08:15:40 +00:00
Eric Fiselier 0af535636e XFAIL noexcept member function throw/catch test under GCC.
I'm still not exactly sure why the test fails, but I suspect it's
a bug in GCC. More investigation needed.

llvm-svn: 302489
2017-05-09 00:11:02 +00:00
Jonas Hahnfeld 57aa0d42d9 [libcxxabi][CMake] Set library dir when built under runtimes/
This will put libraries into the build root's lib/ directory by default.

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

llvm-svn: 302118
2017-05-04 06:04:49 +00:00
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
Petr Hosek d3a3fb8391 [CMake][libcxxabi] Fix the -target and -gcc-toolchain flag handling
CMake has the problem with the single dash variant because of the
space, so use the double dash with equal sign version. These flag
need to be included in compile flags to propagate correctly. We also
don't have to pass the target triple when checking for compiler-rt
since that flag is already included in compile flags now.

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

llvm-svn: 300418
2017-04-16 06:08:34 +00:00
Petr Hosek 5f3d5be3dd [CMake][libcxxabi] Use -nodefaultlibs for CMake checks
Since libc++abi is built with -nodefaultlibs, we should be using this
option even for CMake checks to avoid any inconsistency and also to
avoid dependency on a working C++ standard library just for the setting
up the build itself. The implementation is largely similar to the one
used by libc++.

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

llvm-svn: 299797
2017-04-07 20:10:41 +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
Mehdi Amini 5a403580e3 Uses quote to include cxxabi.h to make sure the local one is included
llvm-svn: 299414
2017-04-04 05:38:38 +00:00
Shoaib Meenai 8377febb37 [libc++abi] Remove missed use of config.h
llvm-svn: 299143
2017-03-31 00:29:25 +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
Shoaib Meenai 5d293eb34a [libc++abi] Remove unistd.h include
This was originally there for the _POSIX_THREADS define, to detect the
presence of pthreads. That went away with the externalized threading
support, so the include can go away too.

config.h is now completely empty. A follow-up commit will remove it
entirely.

llvm-svn: 299087
2017-03-30 16:27:09 +00:00
Eric Fiselier 8524cbaa57 Fully Reformat fallback_malloc.cpp
This patch fully reformats fallback_malloc.cpp. Previously the test
was a mess of different styles and indentations. This made it very
hard to work in and read. Therefore I felt it was best to re-format
the whole thing.

Unfortuantly this means some history will be lost, but hopefully
much of it will still be accessible after ignoring whitespace changes.

llvm-svn: 296960
2017-03-04 03:23:15 +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 6f8d62ddee Fix CMake configuration errors on OS X
llvm-svn: 296954
2017-03-04 02:15:37 +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
Eric Fiselier 6aa4f1d1af Turn on -Wunused-function and cleanup occurances
llvm-svn: 296936
2017-03-04 01:02:35 +00:00
Eric Fiselier 38643b9d8a Work around GCC linking errors within libc++abi due to missing new/delete definitions
llvm-svn: 296823
2017-03-02 21:55:17 +00:00
Eric Fiselier 2ee1d90cb9 [libc++abi] Add option to enable definitions for the new/delete overloads.
Summary:
Currently both libc++ and libc++abi provide definitions for operator new/delete. However I believe this is incorrect and that one or the other should offer them.

This patch adds the CMake option `-DLIBCXXABI_ENABLE_NEW_DELETE_DEFINITIONS` which defaults to `OFF` unless otherwise specified. This means that by default
only libc++ provides the new/delete definitions.



Reviewers: mclow.lists, mehdi_amini, dexonsmith, beanz, jroelofs, danalbert, smeenai, rmaprath, mgorny

Reviewed By: mehdi_amini

Subscribers: cfe-commits

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

llvm-svn: 296801
2017-03-02 19:34:35 +00:00
Eric Fiselier b2577e5d6b [libc++abi] Update new/delete definitions to match libc++
Summary:
Currently both libc++ and libc++abi provide definitions for new/delete. However libc++abi's definitions haven't been updated to include aligned new/delete or sized deallocation.
I don't see any reason why libc++abi shouldn't provide these newer overloads.

This patch copies libc++'s implementation of `new/delete` into libc++abi so that it's now up to date.

After applying this patch I plan to fix a longstanding bug where both libc++ and libc++abi provide definitions for new/delete.


Reviewers: mclow.lists, mehdi_amini, dexonsmith, danalbert, smeenai, rmaprath, jroelofs

Reviewed By: mehdi_amini

Subscribers: cfe-commits

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

llvm-svn: 296787
2017-03-02 19:25:53 +00:00
Eric Fiselier 3781227448 Cleanup new/delete definitions
This patch cleans up how libc++abi handles the definitions for new/delete.
It is in preperation for upcoming changes to fix how both libc++ and libc++abi
handle new/delete.

The primary changes in this patch are:

* Move the definitions for bad_array_length and bad_new_array_length
  into stdlib_exception.cpp. This way stdlib_new_delete.cpp only
  contains new/delete.

* Rename cxa_new_delete.cpp -> stdlib_new_delete.cpp for consistency
  with other files.

* Add a FIXME regarding when stdlib_new_delete.cpp is actually compiled
  as part of the dylib.

llvm-svn: 296715
2017-03-01 23:59:34 +00:00
Ranjeet Singh ef6e672d04 [libcxxabi] Clean up macro usage.
Convention in libcxxabi is to use !defined(FOO) not !FOO.

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

llvm-svn: 296612
2017-03-01 11:42:01 +00:00
Shoaib Meenai fe989a9817 [libc++abi] Clean up visibility
Use the libc++abi visibility macros instead of pragmas or using
visibility attributes directly. Clean up redundant attributes on
definitions (where the declarations already have visibility attributes
applied, from either libc++ or libc++abi headers).

Introduce _LIBCXXABI_WEAK as a drive-by cleanup, which matches the
semantics of _LIBCPP_WEAK.

No functional change. Tested by building on Linux before and after this
change and verifying that the list of exported symbols is identical.

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

llvm-svn: 296576
2017-03-01 03:55:57 +00:00
Eric Fiselier 71e329266a Fix non-reserved macro names LIBCXXABI_NORETURN and LIBCXXABI_ARM_EHABI.
This patch adds the required leading underscore to those macros.

llvm-svn: 296567
2017-03-01 02:23:54 +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
Ranjeet Singh b078439250 [libcxxabi] Fix condition typo in rL296136
Made a mistake in the condition typo because LIBCXXABI_BAREMETAL is always
defined, I should have been checking the contents to see if it's enabled.

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

llvm-svn: 296146
2017-02-24 18:22:59 +00:00
Ranjeet Singh 4987856fbc [libcxxabi] Disable calls to fprintf for baremetal targets.
We've been having issues with using libcxxabi and libunwind for baremetal
targets because fprintf is dependent on io functions, this patch disables calls
to fprintf when building for baremetal in release mode.

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

llvm-svn: 296136
2017-02-24 16:43:36 +00:00
Petr Hosek 460af4bb9e [CMake][libcxxabi] Update the libc++ test module path
The libcxx/test/libcxx Python package has been moved into
libcxx/utils/libcxx in r294651, but libcxxabi's CMakeLists.txt still
looks for the old path.

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

llvm-svn: 295540
2017-02-18 04:37:59 +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
Asiri Rathnayake d717ce580b Fix couple of test failures when using the LIBCXXABI_SILENT_TERMINATE mode.
When libcxxabi is built in LIBCXXABI_SILENT_TERMINATE mode, libcxx test suite reports
two failures:

  std/depr/exception.unexpected/set.unexpected/get_unexpected.pass.cpp
  std/depr/exception.unexpected/set.unexpected/set_unexpected.pass.cpp

This is because the default unexpected handler is set to std::abort instead of
std::terminate which these tests expect.

llvm-svn: 295175
2017-02-15 13:43:05 +00:00
Eric Fiselier 11306e5113 Fix path to libc++'s python test module
llvm-svn: 294671
2017-02-09 23:58:54 +00:00
Petr Hosek ef6f231f56 [libcxxabi][CMake] Support in-tree libunwind when building as part of runtimes
When building as part of runtimes, there is no predefined order in
which the runtimes are loaded, so the targets from other projects
might not be available. We need to rely on HAVE_<name> variables
instead in that case.

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

llvm-svn: 294552
2017-02-09 02:19:30 +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
Asiri Rathnayake 085b612c31 Fix chromium build (libcxxabi)
Pull the dependency on pthread_mach_thread_np() back into libcxxabi.

llvm-svn: 293166
2017-01-26 10:38:03 +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