Commit Graph

134 Commits

Author SHA1 Message Date
Eric Fiselier bf58c8eddb Make LIBCXX_ENABLE_STATIC_ABI_LIBRARY merge libc++.a and libc++abi.a
llvm-svn: 287373
2016-11-18 19:53:45 +00:00
Eric Fiselier edfd47d40f update Apples ABI list to ignore non-std symbols
llvm-svn: 287301
2016-11-18 02:36:58 +00:00
Eric Fiselier 4b10f489fb 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.

llvm-svn: 287294
2016-11-18 01:40:20 +00:00
Eric Fiselier 209a397060 Fix ABI configuration detection on OS X
llvm-svn: 286792
2016-11-14 03:03:13 +00:00
Eric Fiselier 310891f29a Fix CMake set syntax
llvm-svn: 286791
2016-11-14 02:51:30 +00:00
Eric Fiselier 28349f9bf2 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.

llvm-svn: 286789
2016-11-14 02:43:12 +00:00
Eric Fiselier 0f0a077c89 Remove additional function template definitions from the dylib
llvm-svn: 285537
2016-10-31 03:40:29 +00:00
Eric Fiselier 0c3b87d925 Revert addition of __libcpp_library_version
llvm-svn: 285466
2016-10-28 22:37:24 +00:00
Eric Fiselier 53091bf361 Update mac ABI list
llvm-svn: 285383
2016-10-28 06:09:44 +00:00
Eric Fiselier 761e42fa3d 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.

llvm-svn: 285382
2016-10-28 06:06:50 +00:00
Eric Fiselier 18f5baec5a Update revision number in CHANGELOG.TXT
llvm-svn: 285102
2016-10-25 19:44:38 +00:00
Eric Fiselier 10b12f05d4 [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

llvm-svn: 285101
2016-10-25 19:43:44 +00:00
Michal Gorny ef634ecddd [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

llvm-svn: 284494
2016-10-18 16:54:59 +00:00
Eric Fiselier 9a7c3e56fd Remove dead CMake target
llvm-svn: 284216
2016-10-14 09:06:38 +00:00
Eric Fiselier ffb602125a Update OS X ABI list
llvm-svn: 284208
2016-10-14 06:49:30 +00:00
Eric Fiselier 831a86a191 Correct ABI changelog revision number
llvm-svn: 284207
2016-10-14 06:47:37 +00:00
Eric Fiselier 0ae4f23fdc 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

llvm-svn: 284206
2016-10-14 06:46:30 +00:00
Eric Fiselier 35355bb896 Remove two ABI symbols added after the 3.9 release
llvm-svn: 284200
2016-10-14 05:29:46 +00:00
Eric Fiselier 5182ba5a9f Add ABI changelog entry for <any>
llvm-svn: 284199
2016-10-14 05:10:06 +00:00
Eric Fiselier 505233b966 Sort ABI lists by name so that changes don't generate big diffs
llvm-svn: 284198
2016-10-14 05:04:00 +00:00
Eric Fiselier e9c4ddbfb5 Revert r284193 - it is not correct on OS X
llvm-svn: 284194
2016-10-14 04:21:24 +00:00
Eric Fiselier 94b5f18fa4 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.

llvm-svn: 284193
2016-10-14 04:14:24 +00:00
Eric Fiselier 43e72f5ee6 Add ABI list for 3.9 linux
llvm-svn: 284192
2016-10-14 04:06:19 +00:00
Eric Fiselier e58b4672ad Add 3.9 symbol list for OS X
llvm-svn: 284189
2016-10-14 02:55:43 +00:00
Eric Fiselier 5efb3093a5 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.

llvm-svn: 284188
2016-10-14 02:55:19 +00:00
Eric Fiselier 4d968d356f Add OS X abi list
llvm-svn: 284186
2016-10-14 02:32:54 +00:00
Eric Fiselier 78659cdf47 Add ABI Changelog and current symbol list for Linux
llvm-svn: 284185
2016-10-14 02:27:44 +00:00
Eric Fiselier 054fc4cef6 Fix linker script generation for in-tree builds
llvm-svn: 283700
2016-10-09 21:34:03 +00:00
Hal Finkel 5b5f4f0c74 [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.

llvm-svn: 283684
2016-10-09 02:49:31 +00:00
Michal Gorny 2433b26176 [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

llvm-svn: 283659
2016-10-08 10:27:45 +00:00
Kuba Brecka 50bc34ca31 [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

llvm-svn: 281603
2016-09-15 11:04:53 +00:00
Kuba Brecka d634df526d [libcxx] Enable building and testing of libcxx with ThreadSanitizer on OS X
This patch enables building and testing libcxx under ThreadSanitizer on OS X. CMake builds that have -DLLVM_USE_SANITIZER=Thread will automatically build libcxx with -fsanitize=thread and testing via lit then runs under TSan.

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

llvm-svn: 281475
2016-09-14 14:12:50 +00:00
Asiri Rathnayake 8c2bf45da9 [libcxx] Introduce an externally-threaded libc++ variant.
This patch further decouples libc++ from pthread, allowing libc++ to be built
against other threading systems. There are two main use cases:

- Building libc++ against a thread library other than pthreads.

- Building libc++ with an "external" thread API, allowing a separate library to
  provide the implementation of that API.

The two use cases are quite similar, the second one being sligtly more
de-coupled than the first. The cmake option LIBCXX_HAS_EXTERNAL_THREAD_API
enables both kinds of builds. One needs to place an <__external_threading>
header file containing an implementation of the "libc++ thread API" declared
in the <__threading_support> header.

For the second use case, the implementation of the libc++ thread API can
delegate to a custom "external" thread API where the implementation of this
external API is provided in a seperate library. This mechanism allows toolchain
vendors to distribute a build of libc++ with a custom thread-porting-layer API
(which is the "external" API above), platform vendors (recipients of the
toolchain/libc++) are then required to provide their implementation of this API
to be linked with (end-user) C++ programs.

Note that the second use case still requires establishing the basic types that
get passed between the external thread library and the libc++ library
(e.g. __libcpp_mutex_t). These cannot be opaque pointer types (libc++ sources
won't compile otherwise). It should also be noted that the second use case can
have a slight performance penalty; as all the thread constructs need to cross a
library boundary through an additional function call.

When the header <__external_threading> is omitted, libc++ is built with the
"libc++ thread API" (declared in <__threading_support>) as the "external" thread
API (basic types are pthread based). An implementation (pthread based) of this
API is provided in test/support/external_threads.cpp, which is built into a
separate DSO and linked in when running the libc++ test suite. A test run
therefore demonstrates the second use case (less the intermediate custom API).

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

Reviewers: bcraig, compnerd, EricWF, mclow.lists
llvm-svn: 281179
2016-09-11 21:46:40 +00:00
Saleem Abdulrasool 394d351ad7 build: don't add -fPIC on Windows
`-fPIC` doesn't make much sense for Windows, since Windows DLLs aren't compiled
position independent and are instead relocated at runtime.

Patch by Shoaib Meenai!

llvm-svn: 280413
2016-09-01 20:49:54 +00:00
Eric Fiselier 7a05dfa791 Fix syntax error in recent CMake change.
llvm-svn: 280042
2016-08-30 01:10:33 +00:00
Eric Fiselier 21125869ed Fix PR28831 - Bad logic around CMAKE_OSX_SYSROOT and CMAKE_OSX_ARCHITECTURES.
See https://llvm.org/bugs/show_bug.cgi?id=28831 for more information about
the changes.

llvm-svn: 280037
2016-08-30 00:54:37 +00:00
Chris Bieneman f17227a1da [CMake] Be more consistent about naming targets and components
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 libcxx to cxx. 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.

Reviewers: EricWF

Subscribers: cfe-commits

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

llvm-svn: 279675
2016-08-24 22:17:06 +00:00
Petr Hosek 9e49a3376e Allow building both shared and static library
This change allows building both shared and static version of libc++
in a single build, sharing object files between both versions.

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

llvm-svn: 278068
2016-08-08 22:57:25 +00:00
Eric Fiselier a23470efe7 Rework libatomic handling in CMake and LIT.
This patch updates the way libc++ handles checking for libatomic, in part
to prepare for https://reviews.llvm.org/D22073.

Changes:
* 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++
   doesn't need to manually link it.
* 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic
   needs to be manually linked.
* 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the
   test suite.

llvm-svn: 275759
2016-07-18 06:01:50 +00:00
Eric Fiselier c79795874a Add Filesystem TS -- Complete
Add the completed std::experimental::filesystem implementation and tests.
The implementation supports C++11 or newer.

The TS is built as part of 'libc++experimental.a'. Users of the TS need to
manually link this library. Building and testing the TS can be disabled using
the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'.

Currently 'libc++experimental.a' is not installed by default. To turn on the
installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'.

llvm-svn: 273034
2016-06-17 19:46:40 +00:00
Eric Fiselier a0dd66423d Automatically detect export lists for OS X.
Summary:
Libc++ reexports symbols from the system libc++abi using -reexport_symbols_list. This can cause a linker failure if the list contains symbols not defined in the system libc++abi.
This patch attempts to detect the OS X version and use it to determine the correct symbol list. 

It's my understanding that `lib/libc++abi2.exp` should be used on 10.9 and greater. Otherwise 'lib/libc++abi.exp' should be used

This fixes PR25666 (https://llvm.org/bugs/show_bug.cgi?id=25666)

Reviewers: mclow.lists, bcraig, dexonsmith, EricWF

Subscribers: cfe-commits

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

llvm-svn: 272723
2016-06-14 21:55:14 +00:00
Eric Fiselier a5e201fd55 [libcxx] Prefer C++14 over C++11 when building libc++experimental.
Summary:
Currently libc++experimental builds with C++11. This patch changes that to C++14 when supported by the compiler. Although nothing currently requires C++14 the upcoming <experimental/memory_resource> implementation would benefit from it. [1]

Note that libc++.so continues to build with C++11 and is unaffected by this change.

[1] <experimental/memory_resource> provides global resources which must exist for the entire lifetime of the program. In order to ensure that a global resource can be used during program termination there destructors must never be invoked. The only way to do this, while also allowing "constant initialization", is to use a C++14 union.


Reviewers: mclow.lists

Subscribers: pete, cfe-commits

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

llvm-svn: 269070
2016-05-10 16:17:43 +00:00
Eric Fiselier 27cb2f1225 Create new library 'libc++experimental.a' for packaging TS symbols.
Summary:
Out-of-line symbols for <experimental/...> headers are not ABI or API stable and cannot live in the 'libc++.dylib'. Currently they have nowhere to live. I would like to add a new library target `libc++experimental.a` to fix this. 

Previously I had suggested different libraries for different TS's (`libc++filesystem.a`, 'libc++LFTS.a`, ect). I no longer think this is the right approach.
Instead `c++experimental` will hold *all* TS implementations as a single monolithic library. I see two main benefits to this:

1. Users only have to know about and manually link one library.
2. It makes it easy to implement TS's with one or two out-of-line symbols. (Ex. PMRs)

`c++experimental` provides NO ABI compatibility. Symbols can freely be added/removed/changed without concern for ABI stability.
I will add documentation for this after landing this patch (but before adding anything to it).

`c++experimental` only builds as a static library. By default CMake will build/test this library but will *NOT* install it.

This patch adds the CMake and LIT logic needed to build/test the new library. Once this lands I plan on using it to implement parts of `<experimental/memory_resource>`.



Reviewers: mclow.lists

Subscribers: cfe-commits, theraven, krememek, dexonsmith, bcraig, beanz, danalbert

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

llvm-svn: 268443
2016-05-03 21:30:18 +00:00
Eric Fiselier 59e9748cb5 Fix dependencies on install-libcxx CMake target
llvm-svn: 268363
2016-05-03 05:34:38 +00:00
Chris Bieneman 4497e3a1e6 [CMake] Create a separate install target for libcxx headers
This change doesn't impact the behavior of the install-libcxx target which installs whichever libcxx components you build, it just adds a separate target to just install the headers.

llvm-svn: 268124
2016-04-29 22:17:15 +00:00
Vasileios Kalintiris d247ac44cc Re-commit "Introduce a cmake module to figure out whether we need to link with libatomic."
This re-applies commit r260235. However, this time we add -gcc-toolchain
to the compiler's flags when the user has specified the LIBCXX_GCC_TOOLCHAIN
variable.

llvm-svn: 260515
2016-02-11 12:43:04 +00:00
Vasileios Kalintiris 7432c0472d Revert "Introduce a cmake module to figure out whether we need to link with libatomic."
This reverts commit r260235. It breaks LLVM's bootstrap when building
with a -gcc-toolchain and the system's gcc installation does not provide
the libatomic library and its headers. We should check whether
LIBCXX_GCC_TOOLCHAIN is set and adjust the flags accordingly.

llvm-svn: 260323
2016-02-09 23:38:28 +00:00
Vasileios Kalintiris cca79b8700 Introduce a cmake module to figure out whether we need to link with libatomic.
Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

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

llvm-svn: 260235
2016-02-09 17:00:38 +00:00
Akira Hatanaka 6fa38f5ba5 [libcxx] Remove -Wpadded from buildit script.
Per discussion with Eric and Joerg, this commit removes -Wpadded to
silence the warning about the padding inserted at the tail of struct
_Rep_base.

rdar://problem/23932550

llvm-svn: 258900
2016-01-27 01:55:11 +00:00
Eric Fiselier 6627c70df7 Add CMake option LIBCXX_CONFIGURE_IDE to allow for other IDE's.
CLion needs similar configuration changes as MSVC_IDE and XCODE.

llvm-svn: 255851
2015-12-16 23:41:05 +00:00