Commit Graph

44 Commits

Author SHA1 Message Date
Eric Fiselier 6ab12b3c14 Update ABI list for 4.0 release
llvm-svn: 296805
2017-03-02 19:59:53 +00:00
Shoaib Meenai bad28c44eb [libc++] Make _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS export members
When building libc++ with hidden visibility, we want explicit template
instantiations to export members. This is consistent with existing
Windows behavior, and is necessary for clients to be able to link
against a hidden visibility built libc++ without running into lots of
missing symbols.

An unfortunate side effect, however, is that any template methods of a
class with an explicit instantiation will get default visibility when
instantiated, unless the methods are explicitly marked inline or hidden
visibility. This is not desirable for clients of libc++ headers who wish
to control their visibility, and led to PR30642.

Annotate all problematic methods with an explicit visibility specifier
to avoid this. The problematic methods were found by running
https://github.com/smeenai/bad-visibility-finder against the libc++
headers after making the _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS change. The
methods were marked with the new _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
macro, which was created for this purpose.

It should be noted that _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS was originally
intended to expand to default visibility, and was changed to expanding
to default type visibility to fix PR30642. The visibility macro
documentation was not updated accordingly, however, so this change makes
the macro consistent with its documentation again, while explicitly
fixing the methods which resulted in that PR.

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

llvm-svn: 296731
2017-03-02 03:02:50 +00:00
Shoaib Meenai a528e74735 [libc++] Mark some std::num_get method templates inline
D29157 will make explicit template instantiations expand to default
visibility, at which point these method templates will need to be
explicitly marked hidden visibility to avoid leaking into other DSOs.
Unfortunately, because of clang PR32114, they must be marked inline (in
conjunction with `-fvisibility-inlines-hidden`) to actually hide them,
since clang doesn't respect the hidden visibility annotation.

Since this involves an ABI change, mark these methods inline in a
separate change, so that the ABI changes can be reviewed separately and
verified to be safe.

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

llvm-svn: 296729
2017-03-02 02:51:27 +00:00
Eric Fiselier e13037046a update revision in CHANGELOG.TXT and fix python error
llvm-svn: 295399
2017-02-17 01:56:57 +00:00
Eric Fiselier de547c6a23 Remove more basic_string member function templates from the dylib exports
llvm-svn: 295398
2017-02-17 01:53:16 +00:00
Eric Fiselier 0b37f209bf Start libc++ python cleanup and consolidation.
Libc++ frequently creates and uses utilities written in python.
Currently there are python modules under both libcxx/test and
libcxx/util. My goal with these changes is to consolidate them
into a single package under libcxx/utils/libcxx.

llvm-svn: 294644
2017-02-09 22:53:14 +00:00
Eric Fiselier 623fee72c6 Adjust Apple ABI list after r294133
llvm-svn: 294139
2017-02-05 20:17:41 +00:00
Eric Fiselier abf80c6949 Adjust Linux ABI list after r294133
llvm-svn: 294138
2017-02-05 20:14:18 +00:00
Eric Fiselier 89e41b49f6 Update Linux ABI lists to reflect inlining change in LLVM. More investigation tomorrow.
llvm-svn: 292929
2017-01-24 13:03:40 +00:00
Eric Fiselier b26ed3924f Fix handling of Apple target triple when checking the ABI lists.
The check-cxx-abilist rule uses TARGET_TRIPLE to determine which
ABI list to check. However the triple on Apple contains the darwin
version which changes frequently, but libc++ doesn't need
different ABI lists for each darwin version.

This patch strips the minor version and patchlevel from TARGET_TRIPLE
before using it to determine the ABI list.

llvm-svn: 292557
2017-01-20 00:57:08 +00:00
Eric Fiselier 1da55f532c Allow sym_diff.py to report non-zero for non-breaking ABI changes
llvm-svn: 292297
2017-01-18 00:05:01 +00:00
Eric Fiselier d066f3af61 Update version to 5.0
llvm-svn: 291928
2017-01-13 18:29:56 +00:00
Eric Fiselier 1285e4d60e 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.

llvm-svn: 290849
2017-01-03 01:18:48 +00:00
Eric Fiselier 221596df33 Revert r290839 - Fix configuring and building libc++ w/o an ABI library
llvm-svn: 290841
2017-01-02 22:27:45 +00:00
Eric Fiselier 5d25843f66 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.

llvm-svn: 290839
2017-01-02 21:58:06 +00:00
Eric Fiselier ab768a85f6 Fix debug mode build w/o exceptions
llvm-svn: 290652
2016-12-28 05:20:27 +00:00
Eric Fiselier 687d3213f0 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.

llvm-svn: 290651
2016-12-28 04:58:52 +00:00
Shoaib Meenai fe1aacd014 [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

llvm-svn: 290503
2016-12-24 18:05:32 +00:00
Eric Fiselier c7a28dee10 Update darwin ABI list for <variant>
llvm-svn: 288551
2016-12-02 23:14:18 +00:00
Eric Fiselier aa97dee358 Update ABI lists for <variant>
llvm-svn: 288550
2016-12-02 23:11:28 +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
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