Commit Graph

153 Commits

Author SHA1 Message Date
Eric Fiselier
157fd34124 [libc++][CMake] Use debug MSVC runtimes when libc++ is built in debug mode
Summary: This patch allows libc++ to be built against the debug MSVC runtimes instead of just the release ones.

Reviewers: rnk, majnemer, compnerd, smeenai

Subscribers: mgorny, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292006 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-14 07:54:39 +00:00
Eric Fiselier
fdd3c91b5f [libc++] [CMake] Link with /nodefaultlibs on Windows
Summary:
This patch attempts to fix the libc++ build/link so that it doesn't use an default C++ libraries on Windows.  This is needed to prevent linking to MSVC's STL library.

Additionally this patch changes libc++ so that it is always linked with the non-debug DLL's (e.g. `/MD`). This is needed so that the test suite can correctly link the same libraries without needing to know which configuration `c++.dll` was linked with.


Reviewers: compnerd, rnk, majnemer, kimgr, awson, halyavin, smeenai

Subscribers: cfe-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292001 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-14 06:06:47 +00:00
Eric Fiselier
ccb58d0a2c Update version to 5.0
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291928 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-13 18:29:56 +00:00
Petr Hosek
b81ce92008 Revert "[CMake][libcxx] Do not rely on the existence of c++abi or unwind targets"
This reverts commit 94fc5a96f5.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291727 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 23:56:31 +00:00
Petr Hosek
94fc5a96f5 [CMake][libcxx] Do not rely on the existence of c++abi or unwind targets
There is no guaranteed order in which CMake files for individual
runtimes are invoked and therefore we cannot rely on existence of
targets defined in other runtimes. Use the new HAVE_<name> options
instead in those cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-11 00:56:10 +00:00
Eric Fiselier
66134e8a5f [libc++] Cleanup and document <__threading_support>
Summary:
This patch attempts to clean up the macro configuration mess in `<__threading_support>`, specifically the mess involving external threading variants. Additionally this patch adds design documentation for `<__threading_support>` and the configuration macros it uses.

The primary change in this patch is separating the idea of an "external API" provided by `<__external_threading>` and the idea of having an external threading library. Now `_LIBCPP_HAS_THREAD_API_EXTERNAL` means that libc++ should use `<__external_threading>` and that the header is expected to exist.  Additionally the new macro `_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL` is now used to configure for using an "external library"  with the default threading API.

Reviewers: compnerd, rmaprath

Subscribers: smeenai, cfe-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291275 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-06 20:05:40 +00:00
Saleem Abdulrasool
1f2d77816b build: use the platform dependent library prefix/suffix
Use the cmake variables to get the platform dependent values for the
static library prefix and suffix, which can be different from the Unix
preference for "lib", ".a" (e.g. Windows uses "", ".lib" respectively).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290939 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 05:49:57 +00:00
Saleem Abdulrasool
8ddd2697ae build: use more portable spelling for flag
Use `CMAKE_LIBRARY_PATH_FLAG` instead of hard-coding it to -L.  This
silences a warning with cl which expects `/LIBPATH` instead.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290938 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-04 05:49:55 +00:00
Eric Fiselier
cfc5515b9d Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.
This patch re-commits a previous attempt to support building libc++ w/o
an ABI library. That patch was originally reverted because:

1) It forgot to teach the test suite about "default" ABI libraries.

2) Some LLVM builders don't clear the CMake cache between builds. The previous
   patch caused those builders to fail since their old cache entry for
   LIBCXX_CXX_ABI="" is no longer valid.

The updated patch addresses both issues. It works around (2) by adding
a hack to force the builders to update their cache entries. The hack will
be removed shortly once all LLVM builders have run.

Original commit message
-----------------------

Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits
of the C++ STL. However we also support building w/o an ABI library entirely.
This patch fixes building libc++ w/o an ABI library (and incorporates the
`~type_info()` fix in D28211).

The main changes in this patch are:

1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default".
2) Fix CMake bits which treated "none" as "default" on OS X.
3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`.
4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined.

Unfortunately this patch doesn't help clean up the macro mess that we use to
configure for different ABI libraries.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290849 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-03 01:18:48 +00:00
Eric Fiselier
983f38443b Revert r290839 - Fix configuring and building libc++ w/o an ABI library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290841 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-02 22:27:45 +00:00
Eric Fiselier
ea38cde827 Fix configuring and building libc++ w/o an ABI library.
Typically libc++ uses libc++abi or libcxxrt to provide the ABI and runtime bits
of the C++ STL. However we also support building w/o an ABI library entirely.
This patch fixes building libc++ w/o an ABI library (and incorporates the
`~type_info()` fix in D28211).

The main changes in this patch are:

1) Add `-DLIBCXX_CXX_ABI=default` instead of using the empty string to mean "default".
2) Fix CMake bits which treated "none" as "default" on OS X.
3) Teach the source files to respect `-D_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY`.
4) Define ~type_info() when _LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY is defined.

Unfortunately this patch doesn't help clean up the macro mess that we use to
configure for different ABI libraries.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290839 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-02 21:58:06 +00:00
Saleem Abdulrasool
766e557e5a build: tweak macros for Windows build
Move the windows specific macro definitions for compiling c++ into the
target.  Add a number of newer options that are necessary to properly
build libc++ for windows.  This ensures that we do not accidentally
autolink msvcprt (Microsoft's C++ runtime library), do not define linker
pragmas which are msvcprt specific, and do not accidentally encode the
incorrect version of the msvc compatibility version.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290837 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-02 21:40:17 +00:00
Saleem Abdulrasool
1b34b986bc build: make cross-compiling to Windows work on Linux
Disable the manifest bundling on Windows when cross-compiling on
not-Windows.  With this, it is possible to execute the link command from
CMake which will use cmake to invoke the manifest tool to generate a
manifest and pass that to the linker.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290836 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-02 21:09:19 +00:00
Eric Fiselier
ae3128f268 Fix build using the buildit script
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290727 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-29 22:42:45 +00:00
Eric Fiselier
51d64bbc8c Fix debug mode build w/o exceptions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290652 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-28 05:20:27 +00:00
Eric Fiselier
01eb99ac7b Implement a throwing version of _LIBCPP_ASSERT.
This patch implements changes to allow _LIBCPP_ASSERT to throw on failure
instead of aborting. The main changes needed to do this are:

1. Change _LIBCPP_ASSERT to call a handler via a replacable function pointer
   instead of calling abort directly. Additionally this patch implements two
   handler functions, one which aborts and another that throws an exception.

2. Add _NOEXCEPT_DEBUG macro for disabling noexcept spec on function which
   contain _LIBCPP_ASSERT. This is required in order to prevent assertion
   failures throwing through a noexcept function. This macro has no effect
   unless _LIBCPP_DEBUG_USE_EXCEPTIONS is defined.

Having a non-aborting _LIBCPP_ASSERT is very important to allow sane testing of
debug mode. Currently we can only have one test case per file, since the test
case will cause the program to abort. Testing debug mode this way would require
thousands of test files, most of which would be 95% boiler plate. I don't think
this is a feasible strategy. Fortunately using a throwing debug handler solves
these issues.

Additionally this patch rewrites the documentation for debug mode.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290651 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-28 04:58:52 +00:00
Shoaib Meenai
833ad542b5 [libc++] Make __num_get_float hidden
It's an internal function and shouldn't be exported. It's also a source
of discrepancy in the published ABI list; these symbols aren't exported
for me on CentOS 7 or Ubuntu 16.04, leading to spurious check-cxx-abilist
failures.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@290503 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-24 18:05:32 +00:00
Eric Fiselier
f7168e5e0b Update darwin ABI list for <variant>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288551 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 23:14:18 +00:00
Eric Fiselier
f722080ff3 Update ABI lists for <variant>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@288550 91177308-0d34-0410-b5e6-96231b3b80d8
2016-12-02 23:11:28 +00:00
Eric Fiselier
60479ea31b Make LIBCXX_ENABLE_STATIC_ABI_LIBRARY merge libc++.a and libc++abi.a
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287373 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 19:53:45 +00:00
Eric Fiselier
91673636fb update Apples ABI list to ignore non-std symbols
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287301 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 02:36:58 +00:00
Eric Fiselier
0d6941834c Change sym_check to filter non-stdlib symbols.
Currently sym_check almost all names found in the binary, including those
which are defined in other libraries. This makes our ABI lists harder to maintain.

This patch adds a --only-stdlib-symbols option to sym_check which removes
all symbols which aren't possibly provided by libc++. It also re-generates
the linux ABI list after making this change.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@287294 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-18 01:40:20 +00:00
Eric Fiselier
e96aa8cd56 Fix ABI configuration detection on OS X
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286792 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 03:03:13 +00:00
Eric Fiselier
049a1ed8d8 Fix CMake set syntax
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286791 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 02:51:30 +00:00
Eric Fiselier
5e000c6a82 Add check-cxx-abilist target when supported.
This patch adds a `check-cxx-abilist` target which verifies the libc++.so ABI
when the current build configuration matches the configuration used to generate
the ABI lists.

In order to make this change `HandleOutOfTreeLLVM.cmake` needed to be modified
to include `LLVMConfig.cmake` so that `TARGET_TRIPLE` is defined. Hopefully
the changes needed to accommodate this won't break existing build
configurations.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@286789 91177308-0d34-0410-b5e6-96231b3b80d8
2016-11-14 02:43:12 +00:00
Eric Fiselier
d5b0db5249 Remove additional function template definitions from the dylib
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285537 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-31 03:40:29 +00:00
Eric Fiselier
2017e23c4a Revert addition of __libcpp_library_version
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 22:37:24 +00:00
Eric Fiselier
68635ee647 Update mac ABI list
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 06:09:44 +00:00
Eric Fiselier
6994470189 Add __libcpp_version file and __libcpp_library_version function.
This patch does two seperate things. First it adds a file called
"__libcpp_version" which only contains the current libc++ version
(currently 4000). This file is not intended for use as a header. This file
is used by Clang in order to easily determine the installed libc++ version.
This allows Clang to enable/disable certain language features only when the
library supports them.

The second change is the addition of _LIBCPP_LIBRARY_VERSION macro, which
returns the version of the installed dylib since it may be different than
the headers.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285382 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-28 06:06:50 +00:00
Eric Fiselier
da2c55edd9 Update revision number in CHANGELOG.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285102 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:44:38 +00:00
Eric Fiselier
8330b1ec02 [libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib
Summary:
This patch turns on `-fvisibility-inlines-hidden` when building  the dylib. This is important so that libc++.dylib doesn't accidentally export inline-functions which are ODR used somewhere in the dylib.

On OS X this change has no effect on the current ABI of the dylib. Unfortunately on Linux there are already ~20 inline functions which are unintentionally exported by the dylib. Almost all of these are implicitly generated destructors. I believe removing these function definitions is safe because every "linkage unit" which uses these functions has its own definition, and therefore shouldn't be dependent on libc++.dylib to provide them.

Also could a FreeBSD maintainer comment on the ABI compatibility of this patch?



Reviewers: mclow.lists, emaste, dexonsmith, joker-eph-DISABLED, jroelofs, danalbert, mehdi_amini, compnerd, dim

Subscribers: beanz, mgorny, cfe-commits, modocache

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@285101 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:43:44 +00:00
Michal Gorny
7c2afba80b [solaris] Convert the support library to C++ to fix -std=c++11 build
Convert the Solaris xlocale.c compatibility library from plain C to C++
in order to fix the build failures caused by the addition of -std=c++11
to LIBCXX_COMPILE_FLAGS. The additional flag got propagated to the C
file, resulting in error with strict compilers.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284494 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-18 16:54:59 +00:00
Eric Fiselier
472c8c6612 Remove dead CMake target
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284216 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 09:06:38 +00:00
Eric Fiselier
bf702696d4 Update OS X ABI list
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284208 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 06:49:30 +00:00
Eric Fiselier
06e44a7ea8 Correct ABI changelog revision number
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284207 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 06:47:37 +00:00
Eric Fiselier
9acbffa370 Implement P0035R4 -- Add C++17 aligned allocation functions
Summary:
This patch implements the library side of P0035R4. The implementation is thanks to @rsmith.

In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects.


Reviewers: mclow.lists, rsmith

Subscribers: rsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 06:46:30 +00:00
Eric Fiselier
9dbc053b47 Remove two ABI symbols added after the 3.9 release
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 05:29:46 +00:00
Eric Fiselier
8efec5eeb6 Add ABI changelog entry for <any>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284199 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 05:10:06 +00:00
Eric Fiselier
852b521720 Sort ABI lists by name so that changes don't generate big diffs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284198 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 05:04:00 +00:00
Eric Fiselier
7fa27fcbaf Revert r284193 - it is not correct on OS X
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 04:21:24 +00:00
Eric Fiselier
c3d49c930b Re-export two previously exported std::string functions.
These functions were removed from the dylib sometime between the 3.9 release
and now. This patch manually exports them to re-gain ABI compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284193 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 04:14:24 +00:00
Eric Fiselier
977cd9f231 Add ABI list for 3.9 linux
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284192 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 04:06:19 +00:00
Eric Fiselier
959ed21455 Add 3.9 symbol list for OS X
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 02:55:43 +00:00
Eric Fiselier
7d1452eb46 Fix CMake configuration error and add ABI lists for OS X.
The primary reason for this patch is to add the OS X ABI lists for 3.9 and
ToT.

However while working on that I discovered that we incorrectly
exported the libc++abi symbols. Previously we had chosen the wrong CMake
configuration path and that caused us to re-export the c++abi binary instead
of using the symbol lists.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284188 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 02:55:19 +00:00
Eric Fiselier
d6a66c6361 Add OS X abi list
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 02:32:54 +00:00
Eric Fiselier
b17cc02df2 Add ABI Changelog and current symbol list for Linux
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284185 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 02:27:44 +00:00
Eric Fiselier
3bf8a9cb67 Fix linker script generation for in-tree builds
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283700 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 21:34:03 +00:00
Hal Finkel
475cf02300 [CMake] Fix in-tree libcxxabi build support after r283659
r283659 changed the argument to gen_link_script.py from SCRIPT_ABI_LIBNAME to
LIBCXX_LIBRARIES_PUBLIC, assuming that all of the items in the
LIBCXX_LIBRARIES_PUBLIC list were library names. This is not right, however,
for in-tree libcxxabi builds, we might have the target name in this list. There
was special logic to fixup SCRIPT_ABI_LIBNAME for this situation; change it to
apply a similar fixup for LIBCXX_LIBRARIES_PUBLIC.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283684 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-09 02:49:31 +00:00
Michal Gorny
ffac2247af [cmake] Split linked libraries into private & public, for linker script
Introduce LIBCXX_LIBRARIES_PUBLIC in addition to LIBCXX_LIBRARIES that
holds 'public' interface libraries -- that is, libraries that both
libc++ links to and programs linked against it need to link to.

Currently this includes the ABI library and optionally -lunwind (when
LIBCXXABI_USE_LLVM_UNWINDER is on). The libraries are included in the
linker script, in order to make it possible to link C++ programs using
clang with compiler-rt runtime out-of-the-box.

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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283659 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-08 10:27:45 +00:00
Kuba Brecka
86f6997618 [libcxx] Allow sanitizing libcxx with ASan+UBSan simultaneously
Allow building with LLVM_USE_SANITIZER=“Address;Undefined” (and “Undefined;Address”).

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



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@281603 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15 11:04:53 +00:00