summaryrefslogtreecommitdiffstats
path: root/libcxx/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
...
* Recommit r290839 - Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-031-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 290849
* Revert r290839 - Fix configuring and building libc++ w/o an ABI libraryEric Fiselier2017-01-021-6/+5
| | | | llvm-svn: 290841
* Fix configuring and building libc++ w/o an ABI library.Eric Fiselier2017-01-021-5/+6
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 290839
* build: tweak macros for Windows buildSaleem Abdulrasool2017-01-021-3/+0
| | | | | | | | | | | 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. llvm-svn: 290837
* build: further improve flags handling for clSaleem Abdulrasool2017-01-011-7/+13
| | | | | | | | | This allows us to build with cl (or rather clang-cl) by using the correct spelling for `-include` (`/FI` for cl). clang-cl and cl default to C++11/C++14 as they support it rather than permitting an explicit language standard. llvm-svn: 290802
* [libcxx][CMake] Move the warning to HandleOutOfTreeLLVMPetr Hosek2016-12-121-7/+0
| | | | | | | | This currently gives a warning when building libcxx under runtimes. Differential Revision: https://reviews.llvm.org/D27643 llvm-svn: 289418
* [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONSShoaib Meenai2016-12-051-1/+1
| | | | | | | | | | | It's useful to be able to disable visibility annotations entirely; for example, if we're building libc++ static to include in another library, and we don't want any libc++ functions getting exported out of that library. This is a generalization of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT. Differential Revision: https://reviews.llvm.org/D26934 llvm-svn: 288690
* Make LIBCXX_ENABLE_STATIC_ABI_LIBRARY merge libc++.a and libc++abi.aEric Fiselier2016-11-181-0/+3
| | | | llvm-svn: 287373
* Add check-cxx-abilist target when supported.Eric Fiselier2016-11-141-4/+6
| | | | | | | | | | | | | 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
* Fix GCC libc++abi buildEric Fiselier2016-11-131-0/+3
| | | | llvm-svn: 286783
* [CMake] Check runtimes subdir when looking for libcxxabiPetr Hosek2016-11-091-2/+9
| | | | | | | | | The runtimes subdir is the new location for runtimes, we should include it when looking for libcxxabi headers. Differential Revision: https://reviews.llvm.org/D26363 llvm-svn: 286333
* Add start of filesystem benchmarksEric Fiselier2016-10-301-1/+17
| | | | llvm-svn: 285524
* [libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline ↵Eric Fiselier2016-10-251-0/+5
| | | | | | | | | | | | | | | | | | | | | 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
* [libcxx] Use C++14 when building libc++ with muslPetr Hosek2016-10-231-0/+5
| | | | | | | | | musl's pthread implementations use volatile types in their structs which is not being constexpr in C++11 but is in C++14. Differential Revision: https://reviews.llvm.org/D25491 llvm-svn: 284950
* Disable Modules when building the libc++ sources.Eric Fiselier2016-10-141-0/+10
| | | | | | | | | | | | | | | | | Libc++ will not build with modules enabled. In order to support an in-tree libc++ when LLVM_ENABLE_MODULES is ON we need to explicitly disable the feature. Unfortunately the libc++ sources are fundamentally non-modular. For example iostream.cpp defines cout, cerr, wout, ... as char buffers instead of streams in order to better control initialization/destruction. Not shockingly Clang diagnoses this. Many other sources files define _LIBCPP_BUILDING_FOO macros to provide definitions for normally inline symbols (See bind.cpp). Finally The current module.map prohibits using <strstream> in C++11 so we can't build strstream.cpp. I think I can fix most of these issues but until then just disable modules. llvm-svn: 284230
* Fix documentation mis-spelling.Eric Fiselier2016-10-101-1/+1
| | | | | | | I promise to stop misspelling things when the English language gains a program that does strict semantic checking. llvm-svn: 283759
* Fix linker script generation for in-tree buildsEric Fiselier2016-10-091-4/+4
| | | | llvm-svn: 283700
* [cmake] Split linked libraries into private & public, for linker scriptMichal Gorny2016-10-081-0/+4
| | | | | | | | | | | | | | | 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
* Revert r282483 - [cmake] Add linker option "-Wl,-z,defs" in standalone buildMichal Gorny2016-09-271-12/+0
| | | | | | | | | Revert r282483 as it causes build failures due to missing symbols when not linking to -lgcc_s (i.e. doing pure LLVM stack build). The patch can be reintroduced when the build system is fixed to add all needed libraries (libunwind, compiler-rt). llvm-svn: 282524
* [cmake] Add linker option "-Wl,-z,defs" in standalone buildMichal Gorny2016-09-271-0/+12
| | | | | | | | | | | | | | Add the "-Wl,-z,defs" linker option that is used to prevent underlinking. It is already used by LLVM itself but does not get propagated into stand-alone build of libc++. This patch ensures that the option is passed in independently of whether libc++ is built in-tree or out-of-tree. Patch by Lei Zhang. Differential Revision: https://reviews.llvm.org/D24119 llvm-svn: 282483
* [cmake] Strip possibly-inherited compiler flags in in-tree build onlyMichal Gorny2016-09-271-3/+6
| | | | | | | | | | | | | | | | | | Strip the set of flags (including debug defs, -m32) that could be inherited from top-level LLVM build only when in-tree build is performed. This prevents libcxx from confusingly and undesiredly stripping user-supplied flags e.g. when performing packaging system controlled multi-ABI build. Otherwise, in order to perform 32-bit builds the build scripts would have to use LIBCXX_BUILD_32_BITS. However, -m32 is only one of the many different ABI flags for different targets, and it really makes no sense to add separate CMake options for each possible -m* flag and then keep a mapping from well-known flags to the custom CMake options. Differential Revision: https://reviews.llvm.org/D24809 llvm-svn: 282475
* Expect DLL builds on Windows by default and require a custom __config for staticEric Fiselier2016-09-261-0/+10
| | | | | | | | | | | | | | | | | | | builds. On Windows the __declspec(dllimport) and __declspec(dllexport) attributes require linking to a DLL, not a static library. Previously these annotations were disabled by default unless _LIBCPP_DLL was defined. However the DLL configuration is probably the more common one, so it should be supported by default. This patch enables import/export attributes by default and adds a _LIBCPP_DISABLE_DLL_IMPORT_EXPORT macro which can be used to disable this behavior. If libc++ is built as a static library on Windows then a custom __config header will be generated that predefines this macro. This patch is based off work by Shoaib Meenai. llvm-svn: 282449
* [libc++] Add _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY to support GCC ABI ↵Eric Fiselier2016-09-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | compatibility Summary: GCC and Clang handle visibility attributes on the out-of-line definition of externally instantiated templates differently. For example in the reproducer below Clang will emit both 'foo' and 'bar' with default visibility while GCC only emits a non-hidden 'foo'. ``` // RUN: g++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out // RUN: clang++ -std=c++11 -shared -O3 test.cpp && sym_extract.py a.out #define INLINE_VISIBILITY __attribute__((visibility("hidden"), always_inline)) template <class T> struct Foo { void foo(); void bar(); }; template <class T> void Foo<T>::foo() {} template <class T> inline INLINE_VISIBILITY void Foo<T>::bar() {} template struct Foo<int>; ``` This difference creates ABI incompatibilities between Clang and GCC built dylibs. Specifically GCC built dylibs lack definitions for various member functions of `basic_string`, `basic_istream`, `basic_ostream`, `basic_iostream`, and `basic_streambuf` (All of these types are externally instantiated). Surprisingly these missing symbols don't cause many problems because the functions are marked `always_inline` therefore the dylib definition is rarely needed. However when an out-of-line definition is required then GCC built dylibs will fail to link. For example [GCC built dylibs cannot build Clang](http://stackoverflow.com/questions/39454262/clang-build-errors). This patch works around this issue by adding `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` which is used to mark externally instantiated member functions as always inline. When building the library `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` sets the symbol's visibility to "default" instead of "hidden", otherwise it acts exactly the same as `_LIBCPP_INLINE_VISIBILITY`. After applying this patch GCC dylibs now contain: * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7sungetcEv` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5gbumpEi` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7sungetcEv` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9sputbackcEc` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERNS_15basic_streambufIwS2_EE` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_9basic_iosIwS2_EES6_E` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setpEPcS4_` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6snextcEv` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE4swapERS3_` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE4swapERS3_` * `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcm` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_8ios_baseES5_E` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE9pubsetbufEPcl` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekoffExNS_8ios_base7seekdirEj` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_9basic_iosIwS2_EES6_E` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5pbumpEi` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpENS_4fposI11__mbstate_tEE` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE7getlineEPcl` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetcEv` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERNS_15basic_streambufIcS2_EE` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_8ios_baseES5_E` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8in_availEv` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRNS_8ios_baseES5_E` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE6sbumpcEv` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRNS_9basic_iosIcS2_EES6_E` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getERc` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6snextcEv` * `_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEmw` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE7getlineEPwl` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5tellpEv` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getERw` * `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEmc` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE7pubsyncEv` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEE3getEPcl` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRNS_9basic_iosIcS2_EES6_E` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE7pubsyncEv` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sputcEc` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5seekpExNS_8ios_base7seekdirE` * `_ZNKSt3__115basic_streambufIcNS_11char_traitsIcEEE6getlocEv` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5gbumpEi` * `_ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEE4swapERS3_` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5seekpENS_4fposI11__mbstate_tEE` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE5tellpEv` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRS3_S4_E` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEE3getEPwl` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEElsEPFRS3_S4_E` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE4setgEPcS4_S4_` * `_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwmm` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4setgEPwS4_S4_` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEEC1EPNS_15basic_streambufIwS2_EE` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE8pubimbueERKNS_6localeE` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE4swapERS3_` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEEC2EPNS_15basic_streambufIwS2_EE` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE10pubseekposENS_4fposI11__mbstate_tEEj` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5pbumpEi` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sgetcEv` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEE4swapERS3_` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE10pubseekposENS_4fposI11__mbstate_tEEj` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sputnEPKcl` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEE5seekpExNS_8ios_base7seekdirE` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sgetnEPwl` * `_ZNSt3__113basic_ostreamIwNS_11char_traitsIwEEElsEPFRNS_8ios_baseES5_E` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE4setpEPwS4_` * `_ZNSt3__115basic_streambufIcNS_11char_traitsIcEEE5sgetnEPcl` * `_ZNKSt3__115basic_streambufIwNS_11char_traitsIwEEE6getlocEv` * `_ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8pubimbueERKNS_6localeE` * `_ZNSt3__114basic_iostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE8in_availEv` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE` * `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcmm` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE6sbumpcEv` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE10pubseekoffExNS_8ios_base7seekdirEj` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC2EPNS_15basic_streambufIcS2_EE` * `_ZNSt3__113basic_istreamIwNS_11char_traitsIwEEErsEPFRS3_S4_E` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9sputbackcEw` * `_ZNSt3__112basic_stringIwNS_11char_traitsIwEENS_9allocatorIwEEE6__initEPKwm` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sputnEPKwl` * `_ZNSt3__113basic_istreamIcNS_11char_traitsIcEEErsEPFRS3_S4_E` * `_ZNSt3__113basic_ostreamIcNS_11char_traitsIcEEEC1EPNS_15basic_streambufIcS2_EE` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE9pubsetbufEPwl` * `_ZNSt3__115basic_streambufIwNS_11char_traitsIwEEE5sputcEw` This patch has no effect on Clang based builds. Reviewers: mclow.lists, eugenis, danalbert, jroelofs, EricWF Subscribers: beanz, cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D24600 llvm-svn: 281681
* [libc++] Fix and document visibility attributes for Clang, GCC and Windows.Eric Fiselier2016-09-151-1/+0
| | | | | | | | | | | | | | | | | | | | | Summary: This patch fixes a number of problems with the visibility macros across GCC (on Unix) and Windows (DLL import/export semantics). All of the visibility macros are now documented under `DesignDocs/VisibilityMacros.rst`. Now I'll no longer forget the subtleties of each! This patch adds two new visibility macros: * `_LIBCPP_ENUM_VIS` for controlling the typeinfo of enum types. Only Clang supports this. * `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` for redefining visibility on explicit instantiation declarations. Clang and Windows require this. After applying this patch GCC only emits one -Wattribute warning opposed to 30+. Reviewers: mclow.lists, EricWF Subscribers: beanz, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D24602 llvm-svn: 281673
* [libcxx] Introduce an externally-threaded libc++ variant.Asiri Rathnayake2016-09-111-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Enable installation of libc++experimental by default.Eric Fiselier2016-09-071-1/+4
| | | | | | | | | | | | When libc++experimental was originally created it was empty and therefore there was no reason to install it. Now that the library contains <experimental/memory_resource> and <experimental/filesystem> there is a good reason to install it. Specifically this patch enables the installation whenever LIBCXX_INSTALL_LIBRARY is true and LIBCPP_ENABLE_EXPERIMENTAL_LIBRARY is true. llvm-svn: 280773
* Fix or suppress GCC warnings during build.Eric Fiselier2016-08-291-3/+12
| | | | | | | | | | | | | | | | | | | | Summary: Currently a number of GCC warnings are emitted when building libc++. This patch fixes or ignores all of them. The primary changes are: * Work around strict aliasing issues in `typeinfo::hash_code()` by using __attribute__((may_alias)). However I think a non-aliasing `hash_code()` implementation is possible. Further investigation needed. * Add `_LIBCPP_UNREACHABLE()` to switch in `strstream.cpp` to avoid -Wpotentially-uninitialized. * Fix -Wunused-value warning in `__all` by adding a void cast. * Ignore -Wattributes for now. There are a number of real attribute issues when using GCC but enabling the warning is too noisy. * Ignore -Wliteral-suffix since it warns about the use of reserved identifiers. Note Only GCC 7.0 supports disabling this warning. * Ignore -Wc++14-compat since it warns about the sized new/delete overloads. Reviewers: EricWF Differential Revision: https://reviews.llvm.org/D24003 llvm-svn: 280007
* Turn On -DLIBCXX_ENABLE_BENCHMARKS by default.Eric Fiselier2016-08-291-1/+1
| | | | | | | | | | | | | | This patch enables the `cxx-benchmarks` target by default. Note that the target still has to be manually invoked since it isn't included in the default 'make' rule. This patch also gets the benchmarks building w/ GCC. The build previously required the '-stdlib=libc++' flag but upstream patches to Google Benchmark now allow the library to build w/ libc++ and GCC. These changes should make the benchmarks easier to build and test. llvm-svn: 279999
* [Docs] Update libc++ target names after r279675.Eric Fiselier2016-08-281-1/+1
| | | | llvm-svn: 279940
* libc++: add an option to build against compiler-rtSaleem Abdulrasool2016-08-241-0/+5
| | | | | | This mirrors the option in libc++abi to build without libgcc. llvm-svn: 279606
* [CMake] Get libcxx building under LLVM/runtimesChris Bieneman2016-08-181-5/+5
| | | | | | | | | | | | | | | | | | | | | Summary: The new LLVM runtimes build directory requires some basic conventions across the runtime projects. These changes make libcxx build under the runtimes subdirectory. The general idea of the changes is that the runtimes subdirectory requires some conventions to be consistent across runtime projects. I expect to have a few more small patches that build on this to tie up check targets and other things useful in development workflows. Summary of changes in this patch: * Renamed variable LLVM_CONFIG -> LLVM_CONFIG_PATH * Renamed variable LIBCXX_BUILT_STANDALONE -> LIBCXX_STANDALONE_BUILD * Add an include of AddLLVM in the tests subdirectory for add_lit_testsuite. Reviewers: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23696 llvm-svn: 279151
* Add private option to change build dialect from C++11Eric Fiselier2016-08-141-3/+5
| | | | | | | | | | Although libc++ only requires C++11 to build, there are other reasons to turn on a newer dialect in the build. For example IDE's may not highlight any C++14/C++17 in the headers when configured for C++11. This patch add's a private option for changing this. llvm-svn: 278638
* Allow building both shared and static libraryPetr Hosek2016-08-081-0/+5
| | | | | | | | | 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
* CMakeLists.txt cleanups: synchronize version with rest of LLVM, consistent ↵Eugene Zelenko2016-08-081-7/+6
| | | | | | | | spacing. Differential revision: https://reviews.llvm.org/D23091 llvm-svn: 278032
* [libcxx] Add support for benchmark tests using Google Benchmark.Eric Fiselier2016-07-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch does the following: 1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`. 2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL. 3. Allows performance benchmarks to be built as part of the libc++ build. Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks` can be built using the `libcxx-benchmarks` target. On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries. Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions. Known Issues: * `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark. Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel Differential Revision: https://reviews.llvm.org/D22240 llvm-svn: 276049
* Add option to disable __deallocate #warningSaleem Abdulrasool2016-07-121-0/+4
| | | | | | | | | | | | | | From r229162: Visual Studio's SAL extension uses a macro named __deallocate. This macro is used pervasively Using -Werror when building for Windows can force the use of -Wno-#warnings specifically because of this __deallocate #warning. Instead of forcing builds to disable all #warnings, this option allows libc++ to be built without this particular warning, while leaving other #warnings enabled. Patch by Dave Lee! llvm-svn: 275172
* Add -Wno-covered-switch-default while compiling libc++Eric Fiselier2016-06-181-0/+1
| | | | | | | | fstream has a switch over ios_base::seekdir which provides a defensive default case. This seems like the right thing for fstream to do, but we need to disable clangs warning during the build to allow this. llvm-svn: 273092
* Add Filesystem TS -- CompleteEric Fiselier2016-06-171-1/+8
| | | | | | | | | | | | | | 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
* [libcxx] Allow target flags to affect CMake configuration testsEric Fiselier2016-06-021-8/+12
| | | | | | | | | | | | | | | | | | Summary: This patch changes the libc++ 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. This patch fixes: https://llvm.org/bugs/show_bug.cgi?id=24322 Reviewers: danalbert, jroelofs, bcraig, compnerd Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20887 llvm-svn: 271460
* [CMake] Update to requiring CMake 3.4.3Chris Bieneman2016-05-311-1/+1
| | | | | | | | | | | | | | 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/D20828 llvm-svn: 271329
* [libcxx] Allow explicit pthread opt-inBen Craig2016-05-251-0/+7
| | | | | | | | | | | | | | | The existing pthread detection code in __config is pretty good for common operating systems. It doesn't allow cmake-time choices to be made for uncommon operating systems though. This change adds the LIBCXX_HAS_PTHREAD_API cmake flag, which turns into the _LIBCPP_HAS_THREAD_API_PTHREAD preprocessor define. This is a name change from the old _LIBCPP_THREAD_API_PTHREAD. The lit tests want __config_site.in variables to have a _LIBCPP_HAS prefix. http://reviews.llvm.org/D20573 llvm-svn: 270735
* Disable LIBCXX_ENABLE_ABI_LINKER_SCRIPT for static library builds.Asiri Rathnayake2016-05-141-1/+5
| | | | | | | | | | | This option is geared towards shared library builds and causes static library builds to fail if not explicitly disabled. This patch fixes PR27706: https://llvm.org/bugs/show_bug.cgi?id=27706 Thanks rgoodfel@isi.edu for the catch. llvm-svn: 269585
* Create new library 'libc++experimental.a' for packaging TS symbols.Eric Fiselier2016-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* libc++: fix typoJF Bastien2016-03-051-1/+1
| | | | llvm-svn: 262771
* build: silence warnings in in-tree buildSaleem Abdulrasool2016-02-081-14/+17
| | | | | | | | Avoid the developer warnings from cmake when configuring libc++ as part of the LLVM layout. Setup the custom macro paths earlier to re-use the detection logic prior to setting the project properties. llvm-svn: 260071
* Revert r256606 due to compiler-rt sanitizer bot failuresEric Fiselier2015-12-301-17/+17
| | | | llvm-svn: 256614
* Cleanup CMake for out-of-tree buildsEric Fiselier2015-12-301-17/+17
| | | | llvm-svn: 256606
* Add CMake option LIBCXX_CONFIGURE_IDE to allow for other IDE's.Eric Fiselier2015-12-161-1/+7
| | | | | | CLion needs similar configuration changes as MSVC_IDE and XCODE. llvm-svn: 255851
* Add initial support for the MUSL C library.Vasileios Kalintiris2015-11-091-0/+8
| | | | | | | | | | | | | | | | | | | Summary: This patch adds the LIBCXX_LIBC_IS_MUSL cmake option to allow the building of libcxx with the Musl C library. The option is necessary as Musl does not provide any predefined macro in order to test for its presence, like GLIBC. Most of the changes specify the correct path to choose through the various #if/#else constructs in the locale code. Depends on D13407. Reviewers: mclow.lists, jroelofs, EricWF Subscribers: jfb, tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D13673 llvm-svn: 252457
* Only disable linker script when LIBCXX_CXX_ABI_LIBNAME is noneEric Fiselier2015-10-221-2/+15
| | | | llvm-svn: 251063
OpenPOWER on IntegriCloud