Commit Graph

95 Commits

Author SHA1 Message Date
Nico Weber
297ec32b86 Move _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS macro to build system
_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS is currently used to
bring back std::unexpected, which is removed in C++17, but still needed
for libc++abi for backward compatibility.

This macro used to define in cxa_exception.cpp only, but actually
needed for all sources that touches exceptions.
So, a build-system-level macro is better fit to define this macro.

https://reviews.llvm.org/D46056
Patch from Taiju Tsuiku <tzik@chromium.org>!

llvm-svn: 331150
2018-04-29 23:05:11 +00:00
Petr Hosek
86a9ddcd1a [CMake] Support for monorepo layout
Support finding libcxx and libunwind sources in monorepo style layout.

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

llvm-svn: 329208
2018-04-04 17:40:59 +00:00
Don Hinton
ae858bf65f [cmake] [libcxxabi] Fix find_path() problems when cross compiling
When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, these find_path() invocations are looking for paths in
the libcxx and libunwind projects on the host system, not the
target system, which can be done by passing
NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323145
2018-01-22 19:41:05 +00:00
Don Hinton
964ea50ff8 [cmake] [libcxxabi] Don't print warning when tests are disabled.
Summary:
Don't print, possibly erroneous, warning if
LIBCXXABI_INCLUDE_TESTS is false.

This patch fixes a problem introduced in r291367.

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

llvm-svn: 322870
2018-01-18 18:29:36 +00:00
Hans Wennborg
4ebc5ab7a5 Update version to 7.0.0svn
llvm-svn: 321726
2018-01-03 15:42:34 +00:00
Petr Hosek
aa96d2ebbc [libcxxabi][CMake] Provide option to disable installing of the library
This is useful in cases where we only build static library and
libc++abi.a is combined with libc++.a into a single archive in which
case we don't want to have libc++abi.a installed separately. The same
option is already provided by libcxx CMake build.

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

llvm-svn: 318568
2017-11-17 23:25:09 +00:00
NAKAMURA Takumi
83105a4ae1 libcxxabi: Suppress LLVM_ENABLE_MODULES
Differential Revision: https://reviews.llvm.org/D35542

llvm-svn: 309551
2017-07-31 09:35:08 +00:00
Hans Wennborg
a25946c8e8 Update version to 6.0.0svn
llvm-svn: 308461
2017-07-19 13:42:18 +00:00
Petr Hosek
60fe5792ae [libcxxabi][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

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

llvm-svn: 307611
2017-07-11 01:42:26 +00:00
Ismail Donmez
dea7590a04 Set a default value for LIBCXXABI_LIBDIR_SUFFIX, fixes installing into lib64 after r304374
llvm-svn: 305278
2017-06-13 08:16:44 +00:00
Martell Malone
062f8f00ae [libcxxabi] Rework CMakeLists.txt into modules
Refactor cmake to remove dependence on LLVM's cmake modules.
This improves handling of cmake checks when cross compiling and brings
libcxxabi in line with libcxx and other project modules.

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

llvm-svn: 304374
2017-06-01 00:09:20 +00:00
Eric Fiselier
27db230ab0 Remove requirement for libunwind sources. Patch by Shiz.
As per r241993, libunwind_ext.h is not used anymore, and thus only the public libunwind includes are needed.
This eases distro packaging efforts and removes an unneeded requirement for out-of-tree building.

Reviewed as D33178

llvm-svn: 304359
2017-05-31 22:11:42 +00:00
Martell Malone
41119cd07b [libcxxabi] Disable DLL annotations on static
rL288692 renames
_LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT to
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS

llvm-svn: 304110
2017-05-28 22:46:50 +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
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
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
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
Eric Fiselier
6f8d62ddee Fix CMake configuration errors on OS X
llvm-svn: 296954
2017-03-04 02:15:37 +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
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
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
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
Michal Gorny
40180b0360 [cmake] Handle missing LIBUNWIND_* directories gracefully
Add LIBUNWIND_* directories to include path only if they were actually
found, in order to fix the CMake error. Both of the directories are
usually unnecessary since libcxxabi uses only the common part of
unwind.h that is supplied both by GCC and Clang.

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

llvm-svn: 292018
2017-01-14 17:05:16 +00:00
Eric Fiselier
ead6a4fc75 Don't dump llvm-config --cmakedir output if command fails.
This patch adjusts the out-of-tree CMake configuration so that
the stderr output is ignored when an old llvm-config is found
that doesn't support --cmakedir.

llvm-svn: 291993
2017-01-14 03:47:49 +00:00
James Y Knight
0d3145ff8d [libc++abi] Add a silent terminate handler to libcxxabi.
The current std::terminate_handler pulls in some string code, some I/O
code, and more. Since it is automatically setup as the default, this
means that any trivial binary linking against libcxxabi will get this
extra bloat.

This patch allows disabling it as a build-time option, if you want to
avoid the extra bloat.

Patch by Tom Rybka!

Reviewers: EricWF

Subscribers: danalbert, llvm-commits, mgorny

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

llvm-svn: 291946
2017-01-13 19:22:26 +00:00
Hans Wennborg
5d0ca65c98 Bump version to 5.0.0svn
llvm-svn: 291829
2017-01-12 21:36:22 +00:00
Michal Gorny
db2e8acccf [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

llvm-svn: 291506
2017-01-09 23:31:05 +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
Bryant Wong
04060ab619 [libcxxabi] Enable tests by default in standalone.
Tests targets will now be enabled by default when building libcxxabi out of tree
(unless turned off with LIBCXXABI_INCLUDE_TESTS=OFF).

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

llvm-svn: 291378
2017-01-08 00:33:30 +00:00
Bryant Wong
66b5441c86 [libcxxabi] Add flag to conditionally enable tests
Differential Revision: https://reviews.llvm.org/D28449

llvm-svn: 291367
2017-01-07 22:14:04 +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
Kostya Serebryany
4eb60cb9c9 add cxa_demangle_fuzzer
Summary:
All easy-to-find bugs in cxa_demangle where fixed now
(https://bugs.chromium.org/p/chromium/issues/detail?id=606626)
except for one (https://llvm.org/bugs/show_bug.cgi?id=31031).
Now I'd like to properly integrate this fuzzer with the source tree
and then run the fuzzer continuously on https://github.com/google/oss-fuzz

Reviewers: compnerd, mclow.lists, mehdi_amini

Subscribers: cfe-commits, mgorny

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

llvm-svn: 290650
2016-12-28 03:28:29 +00:00
Eric Fiselier
79ff8f0375 Fix GCC libc++abi build
llvm-svn: 286783
2016-11-13 22:27:00 +00:00
Logan Chien
71cdd30e70 [CMake] Fix libc++abi arm build w/o libunwind.
This commit fixes libc++abi build when LLVM unwinder (libunwind_llvm) is
not enabled.

This commit fixes the problem by removing "LLVM_NATIVE_ARCH MATCHES ARM"
from CMakeLists.txt so that LIBCXXABI_USE_LLVM_UNWINDER will only be
defined when LLVM unwinder is enabled.

We need LIBCXXABI_USE_LLVM_UNWINDER becase there is a subtle difference
between the unwinder from libgcc and the one from libunwind_llvm.  For
the unwinder from libgcc, we have to initialize register r12 with the
address of _Unwind_Control_Block; otherwise,
_Unwind_GetLanguageSpecificData() and _Unwind_GetRegionStart() won't
work properly.  Consequently, there is an extra _Unwind_SetGR() when
LLVM unwinder is disabled.  Check cxa_personality.cpp for details.

llvm-svn: 286759
2016-11-13 14:42:15 +00:00
Petr Hosek
bfb371a083 [CMake] Check runtimes subdir when looking for libcxx and libuwind
The runtimes subdir is the new location for runtimes, we should
include it when looking for libcxx and libunwind headers.

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

llvm-svn: 286614
2016-11-11 19:12:58 +00:00
Petr Hosek
48c84f9596 Revert "[CMake] Check runtimes subdir when looking for libcxx and libuwind"
This reverts commit eecb79506d88b268fb0d00cce178213b4aa17933.

llvm-svn: 286334
2016-11-09 03:38:21 +00:00
Petr Hosek
b346e3e527 [CMake] Check runtimes subdir when looking for libcxx and libuwind
The runtimes subdir is the new location for runtimes, we should
include it when looking for libcxx and libunwind headers.

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

llvm-svn: 286332
2016-11-09 03:22:19 +00:00
Mehdi Amini
b4459b1cb2 Fix typo in CMakeLists.txt: provide the path to libcxx checkout and not the include subdir
llvm-svn: 286164
2016-11-07 22:16:27 +00:00
Mehdi Amini
c1f152d8d1 Fix libcxxabi CMake detection of libcxx path to handle LLVM_EXTERNAL_LIBCXX_SOURCE_DIR flag
Differential Revision: https://reviews.llvm.org/D26364

llvm-svn: 286161
2016-11-07 22:07:43 +00:00
Mehdi Amini
a09c7e7e66 Revert "Add some facilities to work with a git monorepo (experimental setup)"
This reverts commit r286123, accidentally commited while testing itself...

llvm-svn: 286124
2016-11-07 17:43:08 +00:00
Mehdi Amini
7b9e9f2857 Add some facilities to work with a git monorepo (experimental setup)
Summary:
Some changes are made to cmake, especially the addition of a new
LLVM_ENABLE_PROJECTS option that makes the build system aware of
the monorepo directory structure.

Also a new script is added in llvm/utils/git-svn/. When present in
the $PATH, it enables a `git llvm` command. It is providing at this
point only the ability to push from the git monorepo: `git llvm push`.
It is intended to evolves with more features, for instance I plan on
features like `git llvm show r284955` to help working with sequential
revision numbers.
The push feature is taken from Justin Lebar's script available here:
https://github.com/jlebar/llvm-repo-tools/

Reviewers: jlebar

Subscribers: mgorny, modocache, llvm-commits

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

llvm-svn: 286123
2016-11-07 17:40:28 +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
Logan Chien
78d8ac368f [CMake] Fix libc++abi standalone cmake build.
The cmake files install directory has been changed to
${prefix}/lib/cmake/llvm since r259821.  Searching cmake modules in
${prefix}/share/llvm/cmake will result in fatal errors.

This commit fixes the out-of-tree build by changing the CMake module
search path to: "$(llvm-config --obj-root)/lib/cmake/llvm"

llvm-svn: 283100
2016-10-03 11:08:17 +00:00
Shoaib Meenai
88c6acfedc [libc++abi] Default to DLL annotations on Windows
`__declspec(dllexport)` and `__declspec(dllimport)` should only be used
when building libc++abi as a DLL, but that's the more common use case,
so default to adding the annotations and add an option to opt out.

Similar to r282449, which made the corresponding change for libc++.

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

llvm-svn: 282470
2016-09-27 03:44:09 +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
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