Commit Graph

504 Commits

Author SHA1 Message Date
Saleem Abdulrasool 6e2aa5e1a9 libc++abi: add a top level option for using CompilerRT
Add an option to opt into compiler-rt instead of libgcc.  This option defaults
to OFF to avoid a behaviour change.  It is not possible to mix and match
different runtime libraries.  Disabling this requires that libc++ is built
accordingly.  This knob is particularly useful for targets that are GCC by
default (i.e. Linux).

llvm-svn: 275505
2016-07-15 00:49:42 +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 2d6714a9c5 Partially revert r270816: build with -fvisibility=hidden.
This patch breaks the ABI on linux when libc++abi.a is statically linked into
libc++.so. Certain libc++ symbols get exported from libc++abi.a as hidden
and therefore they also get hidden in libc++.so.

The symbols is question are:

* _ZNKSt3__121__basic_string_commonILb1EE20__throw_out_of_rangeEv
* _ZNKSt3__121__basic_string_commonILb1EE20__throw_length_errorEv
* _ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv

I imagine we just need to fix the visibility for these symbols in the libc++
headers but I'm reverting the patch until it's sorted.

llvm-svn: 271500
2016-06-02 08:14:28 +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
Ben Craig 658310b83e Missed part of D16545 (static lib testing)
http://reviews.llvm.org/D16545

llvm-svn: 271388
2016-06-01 12:50:30 +00:00
Chris Bieneman 1d72b89580 [CMake] Update to requiring CMake 3.4.3
Summary:
This is as per the discussions on developer lists:

http://lists.llvm.org/pipermail/llvm-dev/2016-April/098780.html
http://lists.llvm.org/pipermail/llvm-dev/2016-May/100058.html

Subscribers: cfe-commits

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

llvm-svn: 271330
2016-05-31 20:21: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
Saleem Abdulrasool 18ef564c8b libc++abi: build with -fvisibility=hidden
Enable building libc++abi with hidden visibility by default.  The ABI mandated
interfaces (and a few extra) are already set up to be externally visible.  This
allows us to ensure that any implementation details are not leaked.

llvm-svn: 270816
2016-05-26 02:12:20 +00:00
Ben Craig 24a986108f Allow explicit pthread opt-in
When building libcxxabi in tree (i.e. in llvm/projects/libcxxabi,
along with llvm/projects/libcxx), libcxx's config_site.in doesn't
get created in a timely manner. This means that any configuration
that is normally set in libcxx's config_site.in needs to be
duplicated in libcxxabi to successfully build libcxxabi. This patch
does exactly that for the _LIBCPP_HAS_THREAD_API_PTHREAD
preprocessor define.

http://reviews.llvm.org/D20574

llvm-svn: 270732
2016-05-25 17:37:38 +00:00
Saleem Abdulrasool f51af6c9cd libc++abi: make __cxa_call_unexpected visible
This may be invoked by the compiler, and needs to be made available so that the
users can reference it.

llvm-svn: 269255
2016-05-11 23:56:37 +00:00
Saleem Abdulrasool 7d5169b68d libc++abi: fix visibility of personalities
The personality routines need to be exposed to the users as the functions
reference the personality routine to handle exceptions.

llvm-svn: 268477
2016-05-04 04:22:29 +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
Eugene Zelenko 7deb1ac8a1 [CMake] Fix misleading error message in CMakeLists.txt.
Differential revision: http://reviews.llvm.org/D17117

llvm-svn: 266635
2016-04-18 17:40:18 +00:00
Ben Craig ab56c4041b Respect LIBCXXABI_LIBDIR_SUFFIX before an install
Prior to this patch, setting LIBCXXABI_LIBDIR_SUFFIX would confuse the
check-libcxxabi target. libc++abi.* would get output to lib instead of
lib${LIBCXXABI_LIBDIR_SUFFIX}, but the tests would look in the suffixed
directory.

Now, we match what libcxx does, and set the CMAKE_*_OUTPUT_DIRECTORY to the
LIBRARY_DIR.

http://reviews.llvm.org/D17410

llvm-svn: 266611
2016-04-18 13:30:38 +00:00
Paul Robinson d74e849270 Update copyright year to 2016.
llvm-svn: 264952
2016-03-30 22:40:47 +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 acd5ee88df [libcxxabi] Teach cxa_demangle about Hexagon's long double size
cxa_demangle's default size for a long double is 10 bytes. Hexagon
only has an 8 byte long double though.

llvm-svn: 258313
2016-01-20 14:10:23 +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 88c15c9d6f Revert r258222 because it's missing files. Will re-commit complete patch
llvm-svn: 258228
2016-01-19 23:40:49 +00:00
Eric Fiselier ccd5d8d801 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: 258222
2016-01-19 23:37:51 +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
Dan Gohman d51bd8dd2e [WebAssembly] Accomodate wasm's 128-bit long double.
llvm-svn: 257614
2016-01-13 16:39:30 +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
Logan Chien 338d6de5fa Fix ARM __cxa_end_cleanup() and gc-sections.
This commit adds SHF_ALLOC and SHF_EXECINSTR section flags to
`.text.__cxa_end_cleanup` section.  This fixes a link error when we are
using integrated-as and `ld.gold` (with `-Wl,--gc-sections` and
`-Wl,--fatal-warnings`.)

Detailed Explanation:

1. There might be some problem with LLVM integrated-as.  It is not
   emitting any section flags for text sections.  (This will be fixed in
   an independent commit.)

2. `ld.gold` will skip the external symbols in the section without
   SHF_ALLOC.  This is the reason why `.text.__cxa_end_cleanup_impl`
   section is discarded even though it is referenced by
   `__cxa_end_cleanup()`.

This commit workaround the problem by specifying the section flags
explicitly.

Fix http://llvm.org/PR21292

llvm-svn: 256241
2015-12-22 14:38:30 +00:00
Eric Fiselier 3c9babc55f [libc++abi] Use libgcc and libgcc_s to provide _Unwind symbols instead of libgcc_eh.a
Summary:
libgcc_eh.a cannot be used when building libc++abi as a shared library (the default configuration). See this post for some more discussion: https://gcc.gnu.org/ml/gcc/2012-03/msg00104.html

This patch reverts back to using libgcc_s when linking libc++abi.so. 


Reviewers: danalbert, chandlerc, mclow.lists, ismail, compnerd

Subscribers: vkalintiris, cfe-commits

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

llvm-svn: 255559
2015-12-14 22:20:04 +00:00
Evgeniy Stepanov 3e01d1b32e Replace cmake check for printf with a check for fopen.
Printf is a builtin, and the check fails with -Werror because of a clang
warning about an incompatible redeclaration.

llvm-svn: 255186
2015-12-10 00:44:42 +00:00
Saleem Abdulrasool 1750b2ba89 .gitignore: ignore vim swap files
llvm-svn: 254692
2015-12-04 02:15:02 +00:00
Saleem Abdulrasool 12315edf03 ibc++abi: mark visibility
Mark functions and types with the appropriate visibility.  This is particularly
useful for environments which explicitly indicate origin of functions (Windows).
This aids in generating libc++abi as a DSO which exposes only the public
interfaces.

llvm-svn: 254691
2015-12-04 02:14:58 +00:00
Saleem Abdulrasool 242d67b687 c++abi: whitespace adjustment
Cleanup some code with clang-format to make the following change easier to
identify material difference.  NFC.

llvm-svn: 254690
2015-12-04 02:14:41 +00:00
Saleem Abdulrasool e113b5e9af c++abi: use __builtin_offsetof instead of offsetof
Use `__builtin_offsetof` in place of `offsetof`.  Certain environments provide a
macro definition of `offsetof` which may end up causing issues.  This was
observed on Windows.  Use `__builtin_offsetof` to ensure correct evaluation
everywhere.  NFC.

llvm-svn: 253435
2015-11-18 05:33:38 +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
Eric Fiselier 453da19d2d Add config.project_obj_root to the libc++abi testsuite
llvm-svn: 250307
2015-10-14 18:20:48 +00:00
Marshall Clow 8ebfb60efa Fix Bug 25103 - _cxa_demangle improperly demangles virtual thunks. Thanks to Jason King for the report and suggested fix
llvm-svn: 250097
2015-10-12 20:45:05 +00:00
Marshall Clow a552480298 Fix incorrect parsing of arguments for nested functions. Reviewed as http://reviews.llvm.org/D13192. Thanks to Anseny Kapoulkine for the patch.
llvm-svn: 249649
2015-10-08 03:02:09 +00:00
Nico Weber 4a88f1ed71 Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and clang-cl/MSVC2013's STL.
libstdc++ needs a few typedefs in malloc_alloc. MSVC's STL needs rebind(),
construct(), destroy().  MSVC2013 also has no snprintf, but it exists in 2015.

llvm-svn: 248129
2015-09-20 18:10:46 +00:00
Saleem Abdulrasool af99cd4174 EH: fix register usage for SjLj
When using SjLj EH, do not use __builtin_eh_return_regno, map directly to the
ID.  This would work on some targets, particularly those where the non-SjLj EH
personality used the same register mapping (0 -> 0, 1 -> 1).  However, this is
not guaranteed.  Avoiding the use of the builtin enables the use of libc++ with
SjLj EH on all targets.

llvm-svn: 248108
2015-09-20 02:08:31 +00:00
Eric Fiselier 388c1a040a Convert LIBCXXABI_BUILD_32_BITS to LLVM_BUILD_32_BITS.
llvm-svn: 246516
2015-09-01 01:02:06 +00:00
Eric Fiselier c79a8f7753 Fix or disable C++11 tests in C++03 mode
llvm-svn: 245531
2015-08-20 01:22:17 +00:00
Eric Fiselier 2838c169a5 [libcxxabi] Add "install-libcxxabi" target.
Summary:
Currently you can't install libc++abi from within the LLVM tree without installing all of LLVM. This patch adds an install rule for libc++abi.


Reviewers: danalbert, compnerd, rengolin, beanz

Subscribers: martell, beanz, jroelofs, cfe-commits

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

llvm-svn: 245461
2015-08-19 17:17:21 +00:00