-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make all toolchains standalone toolchains #780
Comments
Why don't you instead have two distributions the first one with the new layout and the second one with the old + a scary message that that is the deprecated way :) "Update CMake to use the new layout." Updated CMake in AS too? |
An interesting idea, but in practice I think this is roughly equivalent to option 1. Instead of "do you have r18 or r19?", the question for each build system becomes, "do you have r18, r19 type 1, or r19 type 2?" (and then stretch that question out until the transition period closes and we go back to having only one distribution). It wouldn't decrease the disruption faced by users, but it would exacerbate the disruption for build system maintainers. I don't think that is worth saving 1GB of install size. It also would require us maintaining duplicate copies of the CMake toolchain and ndk-build throughout the transition (ditto for any third-party build system). That means more bugs, as well as more unaddressed bugs.
Different team, but I believe they're working on it. To be clear, what I actually meant was update our CMake toolchain file, not the builtin cmake implementation. That is a different bug that will be dealt with after this one. |
Drafts for most of the above todo items are up (edited the original post). They all hinge on us getting a clang update that isn't available yet though, so can't submit until then. |
Why can't we just make stub binaries instead of stub batch scripts? We can have a dozen copies of the same executable that just executes the correct one. There's three architectures to support, but mac and linux are the same, and windows is not that different. It'd be like 5 lines of C++, so it's not like it'd be that bad even if they were completely alien. |
That was something I was considering too. It saves us some space at the cost of additional overhead from |
Yeah, there's also a tiny bit of extra complication compared to linux/mac, since we probably also need to wait for our child to finish or else our parent might return early, but that's a whole extra line of code. |
The MSVCRT/Mingw emulation of
Shell scripts seem fine on Unix. I think most of the trouble from stubs is on Windows, right? Issues with batch files I can think of:
FWIW: A strip batch file does break Gradle:
procmon:
I suspect |
I think the binaries could be linker scripts pointing to the right place, and the headers are probably small enough to not matter. (or they could be "#include "../../../../", if the size of the headers is actually a problem) |
I've filed #812 to track enumerating and lifting more required flags into the Clang driver, but the parts of this feature that will be included in r19 are done. |
What about symbolic links for windows? |
Nothing to be done about it in the short term since the SDK manager doesn't handle symlinks even on Linux. |
* Update external/libcxx from branch 'ndk-release-r19' to e3b997f05256a178bb87a33d9310a46dff9f2a1e - Adapt to layout changes again. Test: ndk/checkbuild.py Bug: android/ndk#780 Change-Id: I514caab36879fdcd3fda8b3740f3cf8efce90710 * Update ndk from branch 'ndk-release-r19' to 91ca6df1f9942b77b31ceb3ce543379b22cace2b - Merge changes from topic "cp" into ndk-release-r19 * changes: Remove ndk-depends. ndk-stack: switch back to toolchains/llvm. ndk-stack: switch to python. Move ndk-gdb out of HostTools. Put the new toolchain back in to toolchains/llvm. - Remove ndk-depends. Judging by the lack of interest on the web, it seems like this probably isn't much used. ReLinker (https://github.com/KeepSafe/ReLinker) seems like a better solution to native library loading problems anyway. Rather than rewrite ndk-depends in Python now, let's see if anyone actually still has a reasonable use for it. (Folks who just want readelf/llvm-readobj should probably just be using those already.) Bug: http://b/22085867 Test: builds Change-Id: I938ddd55586c4ff8768bc7b5e0b356f1c31abed1 - ndk-stack: switch back to toolchains/llvm. Also update the change log to admit that we've rewritten ndk-stack. Bug: http://b/22085867 Test: manual Change-Id: Ideba39bb96bcd631231235b69e5476e524bae567 - ndk-stack: switch to python. We've started to see cases (https://issuetracker.google.com/117306194) where addr2line chokes on DWARF information, so it's probably time to switch to llvm-symbolizer. While doing so, we may as well just switch to a small python script. This changes the output format, because the old format was significantly less useful. In addition to causing ridiculously long lines, it didn't handle inlining. This new script simply outputs whatever llvm-symbolizer has to say, on as many lines as llvm-symbolizer thinks are necessary to accurately represent the situation, rather than trying to parse and reformat it. This script also copies the `Abort message:` line, which is often the most useful line in the tombstone. Why not reuse the platform's `stack`? Because making that work and sharing the code seems like a lot of work for no immediate benefit: the NDK's needs seem a lot simpler, and the obvious improvements one could make to ndk-stack (automatically finding the symbols given an ndk-build/cmake project) aren't in the platform tool anyway. A python script as short as this hopefully encourages folks to roll their own better tools that fit in with however they keep track of their published builds. Example input: 10-24 19:19:57.714 5340 5340 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 10-24 19:19:57.714 5340 5340 F DEBUG : Build fingerprint: 'Android/hikey960/hikey960:Q/PI/enh10051658:userdebug/test-keys' 10-24 19:19:57.714 5340 5340 F DEBUG : Revision: '0' 10-24 19:19:57.714 5340 5340 F DEBUG : ABI: 'arm' 10-24 19:19:57.714 5340 5340 F DEBUG : pid: 5336, tid: 5336, name: crasher >>> crasher <<< 10-24 19:19:57.714 5340 5340 F DEBUG : signal 35 (<debuggerd signal>), code -1 (SI_QUEUE), fault addr -------- 10-24 19:19:57.715 5340 5340 F DEBUG : Abort message: 'attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xe970400c' 10-24 19:19:57.715 5340 5340 F DEBUG : r0 00000000 r1 000014d8 r2 00000023 r3 ffa73890 10-24 19:19:57.715 5340 5340 F DEBUG : r4 000014d8 r5 ffa738a4 r6 e98efc70 r7 0000016b 10-24 19:19:57.715 5340 5340 F DEBUG : r8 ffa73688 r9 00000014 r10 000014d8 r11 00000000 10-24 19:19:57.715 5340 5340 F DEBUG : ip ffa73890 sp ffa73680 lr e9874737 pc e987474a 10-24 19:19:57.719 5340 5340 F DEBUG : 10-24 19:19:57.719 5340 5340 F DEBUG : backtrace: 10-24 19:19:57.719 5340 5340 F DEBUG : #00 pc 0002e74a /system/lib/libc.so (fdsan_error(char const*, ...)+266) 10-24 19:19:57.719 5340 5340 F DEBUG : #1 pc 0002e553 /system/lib/libc.so (android_fdsan_close_with_tag+386) 10-24 19:19:57.719 5340 5340 F DEBUG : #2 pc 0002ec37 /system/lib/libc.so (close+6) 10-24 19:19:57.719 5340 5340 F DEBUG : #03 pc 00001c93 /system/bin/crasher (do_action+786) 10-24 19:19:57.719 5340 5340 F DEBUG : #04 pc 00002a35 /system/bin/crasher (main+56) 10-24 19:19:57.719 5340 5340 F DEBUG : #05 pc 0009695d /system/lib/libc.so (__libc_init+60) 10-24 19:19:57.719 5340 5340 F DEBUG : #06 pc 0000180f /system/bin/crasher (_start_main+38) 10-24 19:19:57.719 5340 5340 F DEBUG : #07 pc 00000306 <anonymous:e9c56000> Example output: ********** Crash dump: ********** Build fingerprint: 'Android/hikey960/hikey960:Q/PI/enh10051658:userdebug/test-keys' Abort message: 'attempted to close file descriptor 3, expected to be unowned, actually owned by FILE* 0xe970400c' #00 0x0002e74a /system/lib/libc.so (fdsan_error(char const*, ...)+266) fdsan_error(char const*, ...) bionic/libc/private/bionic_inline_raise.h:0:3 #1 0x0002e553 /system/lib/libc.so (android_fdsan_close_with_tag+386) android_fdsan_close_with_tag bionic/libc/bionic/fdsan.cpp:0:7 #2 0x0002ec37 /system/lib/libc.so (close+6) close bionic/libc/bionic/fdsan.cpp:381:12 #03 0x00001c93 /system/bin/crasher (do_action+786) #04 0x00002a35 /system/bin/crasher (main+56) #05 0x0009695d /system/lib/libc.so (__libc_init+60) __libc_init bionic/libc/bionic/libc_init_dynamic.cpp:136:8 #06 0x0000180f /system/bin/crasher (_start_main+38) #07 0x00000306 <anonymous:e9c56000> Bug: http://b/22085867 Test: ran manually Change-Id: I80b77f13c32a92adb972191b7b9548249e58b3ce - Move ndk-gdb out of HostTools. Test: ./checkbuild.py ndk-gdb Test: ./checkbuild.py Bug: None Change-Id: Ib4cfa782a27a551115e54204205f484e80990d7b - Put the new toolchain back in to toolchains/llvm. Moving this to an entirely separate directory will likely be too disruptive. While not very difficult to fix in any given build system, there's a significant number of third-party projects that do not even use standalone toolchains. Those few of them using Clang can be kept working for the time being (they'll still break when we remove $NDK/sysroot if they're using `--sysroot` like they should be rather than `-isystem`). This also saves us a small amount of space in the transition period. Although we still need to duplicate binutils, libc++, the sysroot, etc, we can at least dedup Clang. Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#780 Change-Id: I5760e55240fc3ff0ed2fe5385b8dca9394327dd1
* Update external/libcxx from branch 'ndk-release-r19' to b5f21ba0d7ab42e67d67940b294fc9d602249871 - Merge changes from aosp/ndk. Change-Id: I200306530a2672950d91e8782012cfb4b58cbb2e - Fix upstream regression test regression. Will cherry-pick https://reviews.llvm.org/D53956 when it lands, but it's still waiting for review and we need to get beta 1 staged for QA. Test: ndk/checkbuild.py && ndk/run_tests.py Bug: https://github.com/android-ndk/ndk/issues/834 Change-Id: Ia4b1525e1b0b50eb335031ef4196031786301b2c - Update Android.mk to match upstream changes. Test: ndk/checkbuild.py && ndk/run_tests.py Bug: https://github.com/android-ndk/ndk/issues/834 Change-Id: I8830d428e1bb9e82974dfcf157fac0eba15d4f8e - Merge to upstream r345762. Test: ndk/checkbuild.py && ndk/run_tests.py Bug: https://github.com/android-ndk/ndk/issues/834 Change-Id: If652927d7d3bd52e9ce5f38eecdbc0236ba2069e - [NFC] Replace C++1y and C++1z by C++14 and C++17, respectively git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345762 91177308-0d34-0410-b5e6-96231b3b80d8 - [NFC] Mark "Splicing Maps and Sets" as done in LLVM 8.0 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345759 91177308-0d34-0410-b5e6-96231b3b80d8 - Second half of C++17's splicing maps and sets This commit adds a merge member function to all the map and set containers, which splices nodes from the source container. This completes support for P0083r3. Differential revision: https://reviews.llvm.org/D48896 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345744 91177308-0d34-0410-b5e6-96231b3b80d8 - Correct ABI list change wrongly advertised as being in the 7.0 release git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345670 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert "Build with -fvisibility=hidden" I messed it up somewhere and now the tests aren't linking. Reverting while I investigate. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345667 91177308-0d34-0410-b5e6-96231b3b80d8 - Build with -fvisibility=hidden Summary: This change changes the build to use -fvisibility=hidden The exports this patch removes are symbols that should have never been exported by the dylib in the first place, and should all be symbols which the linker won't de-duplicate across SO boundaries, making them safe to remove. After this change, we should be able to apply `_LIBCPP_HIDDEN` to the versioning namespace without changing the export lists. Reviewers: ldionne, mclow.lists Reviewed By: ldionne Subscribers: smeenai, mgorny, libcxx-commits Differential Revision: https://reviews.llvm.org/D53868 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345664 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Correct link to code review for P1006 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345658 91177308-0d34-0410-b5e6-96231b3b80d8 - Make libc++'s versioning namespace customizable Summary: This patch makes the versioning namespace libc++ uses customizable by the user using `-DLIBCXX_ABI_NAMESPACE=__foo`. This allows users to build custom versions of libc++ which can be linked into binaries with other libc++ versions without causing symbol conflicts or ODR issues. Reviewers: mclow.lists, ldionne Reviewed By: ldionne Subscribers: kristina, smeenai, mgorny, phosek, libcxx-commits Differential Revision: https://reviews.llvm.org/D53879 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345657 91177308-0d34-0410-b5e6-96231b3b80d8 - Add link to implementation for P1006R0 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345653 91177308-0d34-0410-b5e6-96231b3b80d8 - Update LLVM version used on Appveyor bot, remove MSVC 2015 bot git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345652 91177308-0d34-0410-b5e6-96231b3b80d8 - Add more benchmarks for std::string. Summary: Added benchmarks for Construct, Copy, Move, Destroy, Relationals and Read. On the ones that matter, the benchmarks tests hot and cold data, and opaque and transparent inputs. Reviewers: EricWF Subscribers: christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D53825 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345611 91177308-0d34-0410-b5e6-96231b3b80d8 - Unify definition of _LIBCPP_BEGIN/END_NAMESPACE_STD git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345561 91177308-0d34-0410-b5e6-96231b3b80d8 - XFAIL test on OS X availability git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345529 91177308-0d34-0410-b5e6-96231b3b80d8 - Adapt to layout changes again. Test: ndk/checkbuild.py Bug: https://github.com/android-ndk/ndk/issues/780 Change-Id: I514caab36879fdcd3fda8b3740f3cf8efce90710 - Added Phab link for P0927 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345526 91177308-0d34-0410-b5e6-96231b3b80d8 - Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible. Patch by Denis Yaroshevskiy (denis.yaroshevskij@gmail.com) The rational and measurements can be found in the bug description: https://bugs.llvm.org/show_bug.cgi?id=39129 Reviewed as https://reviews.llvm.org/D52697 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345525 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix mismatch between size_t and uint64_t in std::set benchmark. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345523 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Use exclude_from_explicit_instantiation instead of always_inline Summary: This commit adopts the exclude_from_explicit_instantiation attribute discussed at [1] and reviewed in [2] in libc++ to supplant the use of __always_inline__ for visibility purposes. This change means that users wanting to link together translation units built with different versions of libc++'s headers into the same final linked image MUST define the _LIBCPP_HIDE_FROM_ABI_PER_TU macro to 1 when building those TUs. Doing otherwise will lead to ODR violations and ABI issues. [1]: http://lists.llvm.org/pipermail/cfe-dev/2018-August/059024.html [2]: https://reviews.llvm.org/D51789 Reviewers: rsmith, EricWF Subscribers: dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D52405 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345516 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix PR39458 _LIBCPP_DEBUG breaks heterogeneous compare. The types/comparators passed to std::upper_bound and std::lower_bound are not required to provided to provide an operator</comp(...) which accepts the arguments in reverse order. Nor are the ranges required to have a strict weak ordering. However, in debug mode we attempted to check the result of a comparison with the arguments reversed, which may not compiler. This patch removes the use of the debug comparator for upper_bound and lower_bound. equal_range et al still use debug comparators when they call __upper_bound and __lower_bound. See llvm.org/PR39458 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345434 91177308-0d34-0410-b5e6-96231b3b80d8 - Work around gcc.gnu.org/PR87766 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345425 91177308-0d34-0410-b5e6-96231b3b80d8 - [NFC] Update comment in libc++ ABI changelog git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345424 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix incorrect use of aligned allocation in get_temporary_buffer. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345403 91177308-0d34-0410-b5e6-96231b3b80d8 - XFAIL sized deallocation test with GCC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345400 91177308-0d34-0410-b5e6-96231b3b80d8 - Run the min/max tests agaist the header <charconv>. Fix that header so it passes. NFC. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345352 91177308-0d34-0410-b5e6-96231b3b80d8 - fix incorrect placement of _LIBCPP_ALWAYS_INLINE in valarray git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345289 91177308-0d34-0410-b5e6-96231b3b80d8 - Implement sized deallocation for std::allocator and friends. Summary: C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own). This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown. On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem. Reviewers: ldionne, mclow.lists Reviewed By: ldionne Subscribers: rsmith, ckennelly, libcxx-commits, christof Differential Revision: https://reviews.llvm.org/D53120 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345281 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Make sure we can build libc++ with -fvisibility=hidden Summary: When building with -fvisibility=hidden, some symbols do not get exported from libc++.dylib. This means that some entities are not explicitly given default visibility in the source code, and that we rely on the fact -fvisibility=default is the default. This commit explicitly gives default visibility to those symbols to avoid being dependent on the command line flags used. The commit also remove symbols from the dylib -- those symbols do not actually need to be exported from the dylib and this should not be an ABI break. Finally, in the future, we may want to mark the whole std:: namespace as having hidden visibility (to switch from opt-out to opt-in), in which case the changes done in this commit will be required. Reviewers: EricWF Subscribers: mgorny, christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D52662 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345260 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert "Fix use of __libcpp_deallocate in dynarray" This reverts commit r345234 as it depended on the sized deallocation commit. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345240 91177308-0d34-0410-b5e6-96231b3b80d8 - Temporarily Revert "Implement sized deallocation for std::allocator and friends." This is breaking the bots here (and related): http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-asan/builds/1428 This reverts commit r345214. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345239 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix use of __libcpp_deallocate in dynarray git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345234 91177308-0d34-0410-b5e6-96231b3b80d8 - Implement sized deallocation for std::allocator and friends. Summary: C++14 sized deallocation is disabled by default due to ABI concerns. However, when a user manually enables it then libc++ should take advantage of it since sized deallocation can provide a significant performance win depending on the underlying malloc implementation. (Note that libc++'s definitions of sized delete don't do anything special yet, but users are free to provide their own). This patch updates __libcpp_deallocate to selectively call sized operator delete when it's available. `__libcpp_deallocate_unsized` should be used when the size of the allocation is unknown. On Apple this patch makes no attempt to determine if the sized operator delete is unavailable, only that the language feature is enabled. This could cause a compile error when using `std::allocator`, but the same compile error would occur whenever the user calls `new`, so I don't think it's a problem. Reviewers: ldionne, mclow.lists Reviewed By: ldionne Subscribers: rsmith, ckennelly, libcxx-commits, christof Differential Revision: https://reviews.llvm.org/D53120 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345214 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert "Teach __libcpp_is_floating_point that __fp16 and _Float16 are" This reverts commits r333103 and r333108. _Float16 and __fp16 are C11 extensions and compilers other than Clang don't define these for C++. Differential Revision: https://reviews.llvm.org/D53670 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345199 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix use of libc++ specific macro in support/test_macros.h git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345173 91177308-0d34-0410-b5e6-96231b3b80d8 - Adjust unsupported C++ versions in some tests Summary: Some tests (mainly the new C++20 calendar library) fail when libc++ is tested with '--param=std=c++98'. The failures happen because the tests actually don't support C++98, but don't mention C++98 in the 'UNSUPPORTED:' line. This change fixes the issue. Reviewers: mclow.lists, ldionne Reviewed By: ldionne Subscribers: arphaman, michaelplatings, libcxx-commits Differential Revision: https://reviews.llvm.org/D53640 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345148 91177308-0d34-0410-b5e6-96231b3b80d8 - Off-by-one errors strike again. Thank goodness for ASAN and the bots. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345076 91177308-0d34-0410-b5e6-96231b3b80d8 - When filling a vector<bool> with stuff, initialize the last word of the storage that you're touching. Otherwise, when we lay down the bits with operator&=, we get UB from reading uninitialized memory. Fixes Bug 39354. Thanks to David Wagner for the bug report. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345067 91177308-0d34-0410-b5e6-96231b3b80d8 - Add benchmark for std::set. Summary: Benchmarks for construct, find, insert and iterate, with sequential and random ordered inputs. It also improves the cartesian product benchmark header to allow for runtime values to be specified in the product. Reviewers: EricWF Subscribers: christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D53523 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345035 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark the move construct/move assign tests as unsupported on C++03 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@345001 91177308-0d34-0410-b5e6-96231b3b80d8 - Add tests for match_results copy/move assignment operators. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344998 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove a 'const' from the synopsis. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344997 91177308-0d34-0410-b5e6-96231b3b80d8 - Updated the issue notes. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344989 91177308-0d34-0410-b5e6-96231b3b80d8 - Add tests for match_results copy/move construction. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344988 91177308-0d34-0410-b5e6-96231b3b80d8 - Added more notes to the issues. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344975 91177308-0d34-0410-b5e6-96231b3b80d8 - Update commnents to reflect the changes for LWG#3127. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344953 91177308-0d34-0410-b5e6-96231b3b80d8 - Update commnents to reflect the changes for LWG#3127. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344951 91177308-0d34-0410-b5e6-96231b3b80d8 - Update commnents to reflect the changes for LWG#3122. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344950 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Don't detect Windows' UCRT with TEST_COMPILER_C1XX The test is trying to avoid saying aligned_alloc on Windows' UCRT, which does not (and can not) implement aligned_alloc. However, it's testing for c1xx, meaning clang on Windows will fail this test when using the UCRT. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344829 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Add missing <stdexcept> to map at tests. Reviewed as https://reviews.llvm.org/D50551 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344821 91177308-0d34-0410-b5e6-96231b3b80d8 - Repair thread-unsafe modifications of n_alive in F.pass.cpp In this example, the ctor of G runs in the main thread in the expression G(), and also in the copy ctor of G() in the DECAY_COPY inside std::thread. The main thread destroys the G() instance at the semicolon, and the started thread destroys the G() after it returns. Thus there is a race between the threads on the n_alive variable. The fix is to join with the background thread before attempting to destroy the G in the main thread. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344820 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Improve reporting when running the lit test suite Summary: Running the test suite with -a will now properly show all the executed commands. The reports also include the environment under which the test is being executed, which is helpful for reproducing issues. Reviewers: EricWF Subscribers: christof, dexonsmith, libcxx-commits Differential Revision: https://reviews.llvm.org/D53215 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344700 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Mark chrono literal unit tests as being unsupported on AppleClang 10 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344661 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Avoid repeating the definition of std:: namespaces This reduces code duplication a tiny bit. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344642 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Remove _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY That macro has been defined to _LIBCPP_HIDE_FROM_ABI_AFTER_V1 for many weeks now, so we're actually replacing uses of it for uses of _LIBCPP_HIDE_FROM_ABI_AFTER_V1 directly. This should not change or break anything since the two macros are 100% equivalent, unless somebody is (incorrectly!) relying on _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY being defined. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344641 91177308-0d34-0410-b5e6-96231b3b80d8 - Recommit <chrono> changes with a couple xtra tests marked to fail on apple's clang. Reviewed as D51762 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344627 91177308-0d34-0410-b5e6-96231b3b80d8 - Partial fix for PR38964. (<string> can't be built with gcc -std=c++03) Reviewed as https://reviews.llvm.org/D52240 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344616 91177308-0d34-0410-b5e6-96231b3b80d8 - Re-apply r344546 "Mark a couple of test cases as 'C++17-only'..." Reverted too much in r344580. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344582 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert r344529 "Implement the first part of the calendar support for C++20" Revert r344535 "Wrap up the new chrono literals in an #ifdef..." Revert r344546 "Mark a couple of test cases as 'C++17-only'..." Some of the buildbot failures were masked by another error, and this one was probably missed. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344580 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Remove custom CMake code targeting Mac OS 10.6 libc++ has dropped support for Mac OS 10.6 for a while, and we don't have any testers set up for that OS. This commit puts in an error message so that people can reach out to the libc++ maintainers in case support for 10.6 is still expected (as opposed to silently failing in weird ways). We can completely drop support for 10.6 and remove the error message some time in the future when we're sure that nobody is relying on it. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344576 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark a couple of test cases as 'C++17-only' pending the resolution of PR#39232 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344546 91177308-0d34-0410-b5e6-96231b3b80d8 - Wrap up the new chrono literals in an #ifdef so that old versions of clang don't complain. I'm looking at you, clang 5.0.1 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344535 91177308-0d34-0410-b5e6-96231b3b80d8 - Implement the first part of the calendar support for C++20. This is still incomplete; there will be more patches coming. Reviewed as D51762 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344529 91177308-0d34-0410-b5e6-96231b3b80d8 - One more local type warning removed from the tests. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344421 91177308-0d34-0410-b5e6-96231b3b80d8 - Update the array tests to not use a local type; removes warnings in C++03. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344417 91177308-0d34-0410-b5e6-96231b3b80d8 - Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344416 91177308-0d34-0410-b5e6-96231b3b80d8 - Add benchmarks for std::function. Summary: Benchmarks for construct, copy, move, swap, destroy and invoke, with 8 different input states. For the cases that matter, it tests with and without allowing constant value propagation from construction into the operation tested. This also adds helper functions to generate the cartesian product of different configurations and generate benchmarks for all of them. Reviewers: EricWF Subscribers: christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D53087 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344415 91177308-0d34-0410-b5e6-96231b3b80d8 - [NFC][libc++] Fix broken link in comment git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344369 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert commit r344254; does not work with C++03 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344261 91177308-0d34-0410-b5e6-96231b3b80d8 - Prefer to use the __is_XXX compiler intrinsics to the (old, busted) __has_XXX intrinsics when implementing type traits. Thanks to Richard Smith for the patch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344254 91177308-0d34-0410-b5e6-96231b3b80d8 - Add a test that shows what happens with throwing destructors. NFC. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344220 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix use of removed _LIBCPP_HAS_NO_BUILTIN_ALIGNED_OPERATOR_NEW_DELETE It was replaced with the better named _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344214 91177308-0d34-0410-b5e6-96231b3b80d8 - Distinguish between library and language support for aligned allocation. There are two cases: 1. The library has all it needs to provide align_val_t and the new/delete overloads needed to support aligned allocation. 2. The compiler has actually turned the language feature on. There are times where libc++ needs to distinguish between the two. This patch adds the additional macro _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION which denotes when case (1) does not hold. _LIBCPP_HAS_NO_ALIGNED_ALLOCATION is defined whenever _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION is defined, or when the compiler has not enabled the language feature. Additionally this patch cleans up a number of other macros related to detection of aligned allocation machinery. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344207 91177308-0d34-0410-b5e6-96231b3b80d8 - Use TEST_STD_VER instead of __cplusplus [NFC] While __cplusplus was only used a few dozen times, TEST_STD_VAR is used more than 2000 times. So we replace the former by the latter for consistency in the tests. There should be no functional change. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344194 91177308-0d34-0410-b5e6-96231b3b80d8 - Use std::scoped_lock only for C++17 and newer This fixes a test failure caused by D53049. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344192 91177308-0d34-0410-b5e6-96231b3b80d8 - Add test macros for always_inline and noinline git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344167 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix linking filesystem benchmarks git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344160 91177308-0d34-0410-b5e6-96231b3b80d8 - Annotate scoped_lock as with scoped_lockable attribute Summary: Scoped capabilities need to be annotated as such, otherwise the thread safety analysis won't work as intended. Fixes PR39234. Reviewers: ldionne Reviewed By: ldionne Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D53049 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344096 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Mark std::async race condition test as unsupported on Darwin PR38682 added a test to check for a race condition in std::future. Part of the fix is part of the dylib, but there is no released version of mac OS X that ships a dylib containing the fix. Hence, this test can (and sometimes does) when testing on OS X. This commit marks the test as unsupported to avoid spurious failures. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@344053 91177308-0d34-0410-b5e6-96231b3b80d8 - Do the math in uniform_int_distribution::operator() as unsigned to prevent UB when overflowing. Also add a UBSAN notification that we're ffine with unsigned overflow. This fixes PR#32617. Thanks to Vincent & Christoph for their help with this issue. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343996 91177308-0d34-0410-b5e6-96231b3b80d8 - Papers and Issues for San Diego git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343923 91177308-0d34-0410-b5e6-96231b3b80d8 - [CMake] Use just basename when copying C++ ABI headers This avoids duplicate directories when the filename includes path. Fixes PR39145 Differential Revision: https://reviews.llvm.org/D52762 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343753 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++][NFC] Add error messages to a couple of static_asserts in span Summary: Add error messages to a couple of static_asserts in span to match the style used in the rest of the file. Also fix an extra paren typo in a assert error message. Committed on behalf of Jason Lovett. Reviewers: ldionne Subscribers: libcxx-commits Differential Revision: https://reviews.llvm.org/D52841 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343725 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove redundant null pointer check in operator delete Summary: C89 4.10.3.2 The free function C99 7.20.3.2 The free function C11 7.22.3.3 The free function If ptr is a null pointer, no action shall occur. _aligned_free on MSDN: If memblock is a NULL pointer, this function simply performs no actions. Reviewers: EricWF, mclow.lists, khng300, hotpxl Reviewed By: mclow.lists, khng300, hotpxl Subscribers: lichray, llvm-commits, hotpxl, khng300, christof, ldionne, cfe-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D52401 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343503 91177308-0d34-0410-b5e6-96231b3b80d8 - Attempt to fix aligned allocation configuration under clang-cl When we're using clang-cl and Microsoft's runtime implementation, we don't provide align_val_t or aligned new/delete ourselves. This patch updates the _LIBCPP_HAS_NO_ALIGNED_ALLOCATION macro to reflect this. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343441 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove one more warning from clang-cl build git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343440 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix Shadowing warning on Windows git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343439 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix even more Clang warnings. This patch disables shift-sign-overflow warnings for now. It also fixes most -Wfloat-equal warnings and -Wextra-semi warnings. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343438 91177308-0d34-0410-b5e6-96231b3b80d8 - Bump default dialect to C++14 for clang-cl git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343437 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove even more clang-cl warnings git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343436 91177308-0d34-0410-b5e6-96231b3b80d8 - Mork more tests as FLAKY git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343435 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove even more warnings from clang-cl build git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343434 91177308-0d34-0410-b5e6-96231b3b80d8 - Turn off warnings under clang-cl git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343433 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix threaded test under no-threading configuration git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343432 91177308-0d34-0410-b5e6-96231b3b80d8 - Attempt to unbreak Windows configuration. Although libc++ doesn't yet support Windows we still have Windows builders to track our progress. Currently the clang-cl configuration seems broken because it doesn't support -std=c++11 and instead requires /std:c++11. This patch attempts to fix this. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343431 91177308-0d34-0410-b5e6-96231b3b80d8 - [cxx2a] Fix warning triggered by r343285 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343369 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Remove Fuchsia-specific knowledge to pick the ABI version Summary: The ABI version used by libc++ is a configuration option just like any other configuration option. It is a knob that can be used by vendors to customize the libc++ that they ship. As such, we should not be hardcoding vendor-specific configuration choices in libc++. When building libc++ for Fuchsia, Fuchsia's build scripts should simply define the libc++ ABI version to 2 -- this will result in the _LIBCPP_ABI_VERSION macro being defined in the __config header that is generated when libc++ is built and installed, which is the correct way to customize libc++'s behavior for specific vendors. Reviewers: phosek, EricWF Subscribers: mgorny, christof, dexonsmith, cfe-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D52397 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@343079 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert r342936 "Remove redundant null pointer check in operator delete" A review for the change was opened in https://reviews.llvm.org/D52401 but the change was committed before being approved by any of the code owners for libc++. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342938 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove redundant null pointer check in operator delete C89 4.10.3.2 The free function C99 7.20.3.2 The free function C11 7.22.3.3 The free function If ptr is a null pointer, no action shall occur. _aligned_free on MSDN: If memblock is a NULL pointer, this function simply performs no actions. Reviewers: EricWF, mclow.lists Subscribers: christof, ldionne, cfe-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D52401 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342936 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Fix the binder deprecation tests on Clang 5. Tested on Docker containers with Clang 4, 5 and 6. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342855 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Fix buildbots on Debian Debian build bots are running Clang 4, which apparently does not support the "deprecated" attribute properly. Clang pretends to support the attribute, but the attribute doesn't do anything. (live example: https://wandbox.org/permlink/0De69aXns0t1D59r) On a separate note, I'm not sure I understand why we're even running the libc++ tests under Clang-4. Is this a configuration we support? I can understand that libc++ should _build_ with Clang 4, but it's not clear to me that new libc++ headers should be usable under older compilers like that. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342854 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Document new symbols __u64toa and __u32toa on Darwin Summary: This is the counterpart for https://reviews.llvm.org/D50130 and https://reviews.llvm.org/D52391 on Darwin. Reviewers: EricWF Subscribers: christof, dexonsmith, cfe-commits, libcxx-commits, lichray Differential Revision: https://reviews.llvm.org/D52396 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342849 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Add deprecated attributes to many deprecated components Summary: These deprecation warnings are opt-in: they are only enabled when the _LIBCXX_DEPRECATION_WARNINGS macro is defined, which is not the case by default. Note that this is a first step in the right direction, but I wasn't able to get an exhaustive list of all deprecated components per standard, so there's certainly stuff that's missing. The list of components this commit marks as deprecated is: in C++11: - auto_ptr, auto_ptr_ref - binder1st, binder2nd, bind1st(), bind2nd() - pointer_to_unary_function, pointer_to_binary_function, ptr_fun() - mem_fun_t, mem_fun1_t, const_mem_fun_t, const_mem_fun1_t, mem_fun() - mem_fun_ref_t, mem_fun1_ref_t, const_mem_fun_ref_t, const_mem_fun1_ref_t, mem_fun_ref() in C++14: - random_shuffle() in C++17: - unary_negate, binary_negate, not1(), not2() <rdar://problem/18168350> Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D48912 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342843 91177308-0d34-0410-b5e6-96231b3b80d8 - [NFC][libcxx] Rename helpers with 4 underscores to something more reasonable git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342840 91177308-0d34-0410-b5e6-96231b3b80d8 - [NFC][libc++] Fix typo in the description of LIBCXX_INCLUDE_BENCHMARKS git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342822 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark [[nodiscard]] tests unsupported on GCC prior to 7.0 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342821 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix UB in SIMD tests. One of the SIMD tests attempted to left shift a value by 42, which is UB when the left hand side is a 32 bit integer type. This patch adjusts the test to use the value 4 instead of 42. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342820 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Readjust nodiscard_extensions.pass.cpp test - just disable for ASAN In rL342814, i have committed a blind fix to unbreak the asan buildbot, but as it was later discussed, the leak is intentional, so we can not fix the failure that way. So this reverts the leak 'fix', and simply disables the test in the presence of ASAN. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342819 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark test as flaky git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342818 91177308-0d34-0410-b5e6-96231b3b80d8 - Correct docs to reference the new libc++ lists. We recently added libcxx-dev and libcxx-commits mailing lists. This patch updates the libc++ documentation to correctly reference the libc++ lists instead of the old Clang ones. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342816 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Blind attempt to fix harmless leak in nodiscard_extensions.pass.cpp test libcxx-libcxxabi-x86_64-linux-ubuntu-asan complains about a leak here. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342814 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Fix the definition of the check-cxx-abilist target on Darwin Summary: r342805 added support for the check-cxx-abilist target on FreeBSD, but broke the target on macOS in doing so. The problem is that the GENERIC_TARGET_TRIPLE gets overwritten after replacing the FreeBSD regular expression, which nullifies the replacement done with the darwin regular expression. Reviewers: dim, EricWF Subscribers: emaste, mgorny, krytarowski, christof, dexonsmith, cfe-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D52394 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342813 91177308-0d34-0410-b5e6-96231b3b80d8 - Document new symbols for __u64toa and __u32toa Summary: They are introduced in r338479; their Linux ABI changes are recorded in r338486. TODO: Record the Mac OS X ABI changes. Reviewers: EricWF Reviewed By: EricWF Subscribers: christof, ldionne, libcxx-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D52391 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342810 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Add _LIBCPP_ENABLE_NODISCARD and _LIBCPP_NODISCARD_EXT to allow pre-C++2a [[nodiscard]] Summary: The `[[nodiscard]]` attribute is intended to help users find bugs where function return values are ignored when they shouldn't be. After C++17 the C++ standard has started to declared such library functions as `[[nodiscard]]`. However, this application is limited and applies only to dialects after C++17. Users who want help diagnosing misuses of STL functions may desire a more liberal application of `[[nodiscard]]`. For this reason libc++ provides an extension that does just that! The extension must be enabled by defining `_LIBCPP_ENABLE_NODISCARD`. The extended applications of `[[nodiscard]]` takes two forms: 1. Backporting `[[nodiscard]]` to entities declared as such by the standard in newer dialects, but not in the present one. 2. Extended applications of `[[nodiscard]]`, at the libraries discretion, applied to entities never declared as such by the standard. Users may also opt-out of additional applications `[[nodiscard]]` using additional macros. Applications of the first form, which backport `[[nodiscard]]` from a newer dialect may be disabled using macros specific to the dialect it was added. For example `_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17`. Applications of the second form, which are pure extensions, may be disabled by defining `_LIBCPP_DISABLE_NODISCARD_EXT`. This patch was originally written by me (Roman Lebedev), then but then reworked by Eric Fiselier. Reviewers: mclow.lists, thakis, EricWF Reviewed By: thakis, EricWF Subscribers: llvm-commits, mclow.lists, lebedev.ri, EricWF, rjmccall, Quuxplusone, cfe-commits, christof Differential Revision: https://reviews.llvm.org/D45179 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342808 91177308-0d34-0410-b5e6-96231b3b80d8 - Similar to the handling of darwin target triples, strip the version numbers off of freebsd target triples, when generating the name of the ABI list file for check-cxx-abilist target. Also remove unnecessary parentheses in the regex for darwin, and slightly reword the comment. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342805 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove a bunch of empty subdirectories. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342803 91177308-0d34-0410-b5e6-96231b3b80d8 - fix some typos in the doc git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342628 91177308-0d34-0410-b5e6-96231b3b80d8 - add a quick link to libc++abi git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342625 91177308-0d34-0410-b5e6-96231b3b80d8 - refresh the libc++ homepage git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342624 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix diagnostic regex in variant tests to tolerate older clang versions git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342609 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert "Implement LWG 2221 - No formatted output operator for nullptr." This reverts r342566 as it causes on bots linker errors like > Undefined symbols for architecture i386: > "std::__1::basic_ostream<char, std::__1::char_traits<char> >::operator<<(std::nullptr_t)", referenced from: git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342599 91177308-0d34-0410-b5e6-96231b3b80d8 - Implement LWG 2221 - No formatted output operator for nullptr. Reviewed as https://reviews.llvm.org/D44263 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342566 91177308-0d34-0410-b5e6-96231b3b80d8 - Don't require relops on variant alternatives to all return the same type. Libc++ correctly asserts that a set of visitors for a variant all return the same type. However, we use the visitation machinary to perform relational operations. This causes a static assertion when some of the alternatives relops return a UDT which is implicitly convertible to bool instead of 'bool' exactly. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342560 91177308-0d34-0410-b5e6-96231b3b80d8 - Remove unused include of "verbose_assert.h" git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342524 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix typo git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342361 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark LWG#3102 as complete. No code changes, but I updated a test or two git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342103 91177308-0d34-0410-b5e6-96231b3b80d8 - Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342073 91177308-0d34-0410-b5e6-96231b3b80d8 - Actually mark LWG#2953, don't just say you've done so in r342070 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342071 91177308-0d34-0410-b5e6-96231b3b80d8 - mark LWG#2953 as complete. No code changes required, but added a couple of extra tests. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342070 91177308-0d34-0410-b5e6-96231b3b80d8 - Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulates it from the singlar; this means it will only return 0 or 1. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342063 91177308-0d34-0410-b5e6-96231b3b80d8 - Implement LWG #3017. list splice functions should use addressof git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@342057 91177308-0d34-0410-b5e6-96231b3b80d8 - Update the synopsis for <version>. NFC git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@341990 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix PR# 38900 - don't call swap inside of random_shuffle when we'd be swapping an element with itself git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@341975 91177308-0d34-0410-b5e6-96231b3b80d8 - ReleaseNotes: update links to use https git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@341789 91177308-0d34-0410-b5e6-96231b3b80d8 - [asan] Update a vector's storage annotation during destruction. Reviewed as https://reviews.llvm.org/D50101. Thanks to bobsayshilol (Ben) for the patch. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@341671 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Add a link to the Release notes from the main libc++ documentation git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@341551 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Add ReleaseNotes.rst file for release notes git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@341550 91177308-0d34-0410-b5e6-96231b3b80d8 - Last week, someone noted that a couple of the time_point member functions were not constexpr. I looked, and they were right. They were made constexpr in p0505, so I looked at all the other bits in that paper to make sure that I didn't miss anything else. There were a couple methods in the synopsis that should have been marked constexpr, but the code was correct. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340992 91177308-0d34-0410-b5e6-96231b3b80d8 - Use addressof instead of operator& in make_shared. Fixes PR38729. As a drive-by, make the same change in raw_storage_iterator (twice). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340823 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix ODR violation: namespace-scope helpers should not be declared 'static'. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340778 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark P0556 as 'in progress' git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340752 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Fix handling of negated character classes in regex Summary: This commit fixes a regression introduced in r316095, where we don't match inverted character classes when there's no negated characrers in the []'s. rdar://problem/43060054 Reviewers: mclow.lists, timshen, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50534 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340609 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Remove race condition in std::async Summary: The state associated to the future was set in one thread (with synchronization) but read in another thread without synchronization, which led to a data race. https://bugs.llvm.org/show_bug.cgi?id=38181 rdar://problem/42548261 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51170 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340608 91177308-0d34-0410-b5e6-96231b3b80d8 - Comment out #define __cpp_lib_node_extract, we only support half of that functionality Differential revision: https://reviews.llvm.org/D51172 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340544 91177308-0d34-0410-b5e6-96231b3b80d8 - Disable the aligned allocation test on old mac versions instead of XFAILing it It looks like this test XPASSes when the deployment target is older than the OS of the system the test is running on. It looks like we run the tests with -mmacosx-version-min=10.12, and that makes the test expect to fail, but it passes. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340427 91177308-0d34-0410-b5e6-96231b3b80d8 - Add diagnostics for min/max algorithms when a InputIterator is used. These algorithms require a ForwardIterator or better. Ensure we diagnose the contract violation at compile time instead of of silently doing the wrong thing. Further algorithms will be audited in upcoming patches. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340426 91177308-0d34-0410-b5e6-96231b3b80d8 - Attempt to unbreak filesystem tests on certain linux distros. On some platforms clock_gettime is in librt, which we don't link by default when building the tests. However it is required by the filesystem tests. This patch introduces a workaround which links librt whenever the filesystem tests are enabled. The workaround should later be replaced with a patch that selectively links both libc++fs and librt only when building filesystem specific tests. However, the way the test configuration is set up right now, this is non-trivial. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340406 91177308-0d34-0410-b5e6-96231b3b80d8 - Fix Bug 38644: multimap::clear() missing exception specifier. Add noexcept tests for all the containers that have clear(). git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340385 91177308-0d34-0410-b5e6-96231b3b80d8 - Teach libc++ to use native NetBSD's max_align_t Summary: The NetBSD headers ship with max_align_t, that is not compatible with the fallback version in libc++. There is no defined a compiler specific symbol in the headers like: - __CLANG_MAX_ALIGN_T_DEFINED - _GCC_MAX_ALIGN_T - __DEFINED_max_align_t Sponsored by <The NetBSD Foundation> Reviewers: chandlerc, dlj, EricWF, joerg Reviewed By: joerg Subscribers: bsdjhb, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D47814 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340224 91177308-0d34-0410-b5e6-96231b3b80d8 - Refactor the newly created <bit> header. Still (almost) NFC. Reviewed as https://reviews.llvm.org/D50876 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340049 91177308-0d34-0410-b5e6-96231b3b80d8 - Recommit r339943 - Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815 - with a fix for the sanitizer bots git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@340045 91177308-0d34-0410-b5e6-96231b3b80d8 - Revert "Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815" Breaks build on sanitizer bots. This reverts commit r339943. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339971 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Use correct rand.eng.mers all-zeroes seed sequence fallback Summary: When a seed sequence would lead to having no non-zero significant bits in the initial state of a `mersenne_twister_engine`, the fallback is to flip the most significant bit of the first value that appears in the textual representation of the initial state. rand.eng.mers describes this as setting the value to be 2 to the power of one less than w; the previous value encoded in the implementation, namely one less than "2 to the power of w", is replaced by the correct value in this patch. Reviewers: mclow.lists, EricWF, jasonliu Reviewed By: mclow.lists Subscribers: mclow.lists, jasonliu, EricWF, christof, ldionne, cfe-commits Differential Revision: https://reviews.llvm.org/D50736 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339969 91177308-0d34-0410-b5e6-96231b3b80d8 - Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339943 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] By default, do not use internal_linkage to hide symbols from the ABI Summary: https://reviews.llvm.org/D49240 led to symbol size problems in Chromium, and we expect this may be the case in other projects built in debug mode too. Instead, unless users explicitly ask for internal_linkage, we use always_inline like we used to. In the future, when we have a solution that allows us to drop always_inline without falling back on internal_linkage, we can replace always_inline by that. Note that this commit introduces a change in contract for existing libc++ users: by default, libc++ used to guarantee that TUs built with different versions of libc++ could be linked together. With the introduction of the _LIBCPP_HIDE_FROM_ABI_PER_TU macro, the default behavior is that TUs built with different libc++ versions are not guaranteed to link. This is a change in contract but not a change in behavior, since the current implementation still allows linking TUs built with different libc++ versions together. Reviewers: EricWF, mclow.lists, dexonsmith, hans, rnk Subscribers: christof, cfe-commits Differential Revision: https://reviews.llvm.org/D50652 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339874 91177308-0d34-0410-b5e6-96231b3b80d8 - Selectively import timespec_get into namespace std, since some C libraries don't have it. Reviewed as https://reviews.llvm.org/D50799 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339816 91177308-0d34-0410-b5e6-96231b3b80d8 - Mark the at_exit and at_quick_exit tests as unsupported under C++98 an 03, since those calls were introduced in C++11. They're already guarded by an ifdef in the code, so this is a 'belt-and-suspenders' change. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339804 91177308-0d34-0410-b5e6-96231b3b80d8 - libcxx: Mark __temp_value::__temp_value as _LIBCPP_NO_CFI. This constructor needs to cast a pointer to uninitialized memory to a pointer to object type in order to call allocator_traits::construct(). This cast is not allowed when CFI cast checks are enabled. I did this instead of marking __addr() as _LIBCPP_NO_CFI so that we don't lose CFI checks on get() or the dtor. Differential Revision: https://reviews.llvm.org/D50743 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339797 91177308-0d34-0410-b5e6-96231b3b80d8 - For FreeBSD, don't define _M in nasty_macros.hpp Because FreeBSD uses _M in its <sys/types.h>, and it is hard to avoid including that header, only define _M to NASTY_MACRO for other operating systems. This fixes almost 2000 unexpected test failures. Discussed with Eric Fiselier. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339794 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Fix XFAILs for aligned allocation tests on older OSX versions Summary: Since r338934, Clang emits an error when aligned allocation functions are used in conjunction with a system libc++ dylib that does not support those functions. This causes some tests to fail when testing against older libc++ dylibs. This commit marks those tests as UNSUPPORTED, and also documents the various reasons for the tests being unsupported. Reviewers: vsapsai, EricWF Subscribers: christof, dexonsmith, cfe-commits, mclow.lists, EricWF Differential Revision: https://reviews.llvm.org/D50341 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339743 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Disable failing C11 feature tests for <cfloat> and <float.h> Summary: Those tests are breaking the test bots. A Bugzilla has been filed to make sure those tests are re-enabled: https://bugs.llvm.org/show_bug.cgi?id=38572 Reviewers: mclow.lists, EricWF Subscribers: krytarowski, christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50748 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339742 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Detect C11 features on non-Clang compilers Summary: The macros were inside `#if defined(_LIBCPP_COMPILER_CLANG)`, which means we would never detect C11 features on non-Clang compilers. According to Marshall Clow, this is not the intended behavior. Reviewers: mclow.lists, EricWF Subscribers: krytarowski, christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50748 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339741 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Fix incorrect definition of TEST_HAS_C11_FEATURES Summary: The macro was not defined in C++11 mode when it should have been, at least according to how _LIBCPP_HAS_C11_FEATURES is defined. Reviewers: mclow.lists, EricWF, jfb, dexonsmith Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50719 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339702 91177308-0d34-0410-b5e6-96231b3b80d8 - [CMake] Fix the LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY option This option should be available if LIBCXX_ENABLE_SHARED is enabled, not LIBCXX_ENABLE_STATIC. This fixes a typo from SVN r337814. Differential Revision: https://reviews.llvm.org/D50691 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339697 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Add missing #include in C11 features tests Summary: These #includes are quite important, since otherwise any #if TEST_STD_VER > 14 && defined(TEST_HAS_C11_FEATURES) checks are always false, and so we don't actually test for C11 support in the standard library. Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50674 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339675 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] Mark charconv tests as failing for previous libcxx versions. <charconv> was added in r338479. Previous libcxx versions don't have this functionality and corresponding tests should be failing. Reviewers: mclow.lists, ldionne, EricWF Reviewed By: ldionne Subscribers: christof, dexonsmith, lichray, EricWF, cfe-commits Differential Revision: https://reviews.llvm.org/D50543 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339451 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Enable aligned allocation based on feature test macro, irrespective of standard Summary: The current code enables aligned allocation functions when compiling in C++17 and later. This is a problem because aligned allocation functions might not be supported on the target platform, which leads to an error at link time. Since r338934, Clang knows not to define __cpp_aligned_new when it's not available on the target platform -- this commit takes advantage of that to only use aligned allocation functions when they are available. Reviewers: vsapsai, EricWF Subscribers: christof, dexonsmith, cfe-commits, EricWF, mclow.lists Differential Revision: https://reviews.llvm.org/D50344 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339431 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Avoid -Wunused-local-typedef in node_handle.pass.cpp. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339218 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Allow a standard library that implements LWG 1203 in istream.rvalue/rvalue.pass.cpp (Still pending review at https://reviews.llvm.org/D47400 which has been open since may; will ask for forgiveness rather than permission :) ) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339214 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Remove nonportable locale assumption in basic.ios.members/narrow.pass.cpp I'm not sure if libcxx is asserting UTF-8 here; but on Windows the full char value is always passed through in its entirety, since the default codepage is something like Windows-1252. The replacement character is only used for non-chars there; and that should be a more portable test everywhere. (Still pending review at https://reviews.llvm.org/D47395 which has been open since may; will ask for forgiveness rather than permission :) ) git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339213 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Remove asserts that <cstddef> and <stdexcept> are included by <bitset> Reviewed as https://reviews.llvm.org/D50421 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339212 91177308-0d34-0410-b5e6-96231b3b80d8 - [libcxx] [test] Add missing <stdexcept> in several tests. Reviewed as https://reviews.llvm.org/D50420 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@339209 91177308-0d34-0410-b5e6-96231b3b80d8 - [libc++] Add the _LIBCPP_HIDE_FROM_ABI_AFTER_V1 macro Summary: This macro allows hiding symbols from the ABI when the library is built with an ABI version after ABI v1, which is currently the only stable ABI. This commit defines `_LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY` to be `_LIBCPP_HIDE_FROM_ABI_AFTER_V1`, meaning that symbols that were only exported by the library for historical reasons are not exported anymore in the unstable ABI. Because of that, this commit is an ABI break for ABI v2. This ABI version is not stable, however, so this should n…
Android introduced a unified tools layout in kDK r19c, and the old layout was eventually removed in r22b. Without this change, running the lldb tests with NDK r22b or newer fails compiling the inferiors. This change updates `Android.rules` to match the newer unified tools layout, which is described in more detail at android/ndk#780. NOTE: With this change in place, ONLY NDK r19c and later can be used when running the lldb tests. The older layout is no longer supported.
Android introduced a unified tools layout in kDK r19c, and the old layout was eventually removed in r22b. Without this change, running the lldb tests with NDK r22b or newer fails compiling the inferiors. This change updates `Android.rules` to match the newer unified tools layout, which is described in more detail at android/ndk#780. NOTE: With this change in place, ONLY NDK r19c and later can be used when running the lldb tests. The older layout is no longer supported.
Android introduced a unified tools layout in NDK r19 (2019) and removed the old layout in r22 (2021). Running lldb tests with NDK r22 or newer fails when compiling the test inferiors. This change updates `Android.rules` to match the newer unified tools structure introduced in NDK r19, which is described in more detail at android/ndk#780. NOTE: After this change, ONLY NDK r19c and later can be used when running the lldb tests. The pre-2019 NDK structure is no longer supported.
This has been discussed several times, but we haven't had a bug filed for this yet. Rather lengthy since I wanted to explain our thinking on some of these decisions since I suspect there will be many questions. Don't hesitate to chime in if something in here isn't clear and speak up if you have specific concerns. I have a prototype of this that passes all of the NDK's tests so it has at least proven feasible, but I'd be very interested in hearing about any specific issues people think need to be addressed that I've missed.
Overview
Properly compiling and linking code for Android is much harder than it needs to be. Compilers must be invoked with a specific set of flags that may change over time, defaults change, and if not using a build system that supports the NDK you need to use a standalone toolchain, which many people don't seem to discover.
Instead, we can hoist most of this logic into the compiler driver (now that we have only one compiler driver to support). The driver can predict the location of the sysroot relative to its own location, and we can install binutils alongside clang so it is automatically picked up as well.
We can also do the same for the libc++ headers and libraries, though since the compiler will always link the STL after all of the user's specified libraries it is not possible to avoid issues like #379 when the dependencies are broken (if the dependencies are all correct everything works fine, but there are a lot of broken prebuilts out there that ndk-build currently has no problems with, though cmake and standalone toolchains do). There is not much that can be done about this without having the compiler driver (or the linker) re-order the user's inputs, which is not something any compiler/linker I know of does.
The various default build/linker flags Android uses ought to also be part of the clang driver. This includes things like
-mfloat-abi=softfp
for arm32 (this might actually be the case forarmv7-linux-androideabi
already, need to check). This also includes things like-Wl,--warn-shared-textrel
, since code that would emit this warning will not load on Android.With all of the above taken care of, we (and more importantly, third-party build system maintainers) can remove a bunch of code the is duplicated throughout the various systems. The
make_standalone_toolchain.py
script becomes obsolete, since invoking$NDK/toolchain/bin/clang++ -target $TARGET
will work out of the box. We'll keep the script around since there's no sense in breaking build scripts people have that use this, but it will be more or less a no-op. We should also look in to installingaarch64-linux-android-clang++
and co to the toolchain directory that default to the appropriate target, since autoconf systems mostly are not aware of the need for-target
afaik.Migration
Making these changes does necessitate making some changes to the layout of the NDK. Clang (and GCC, FWIW, not that we use that any more) already had logic to find binutils/sysroots/etc based on its own install directory. All we need to do to take advantage of it is to:
Getting Clang to use the various NDK tool/library paths as-is would have been a much more invasive change to Clang and prevented us from sharing as many code paths with the other Clang targets, making it much more fragile and less likely to be accepted (the NDK's layout is very inconsistent currently; just explaining things like "well the arm binutils is in arm-linux-androideabi-4.9, even though it's not GCC 4.9, and not even GCC for that matter, btw the x86 one is just x86-4.9 rather than being triple-prefixed for some reason" seems like it would make these changes difficult to upstream).
As such we have a few options to consider as to how we approach this problem logistically:
We're not going to do this. It's an option, but the only benefit is that it doesn't increase the size of the NDK, but it does make for a ton of migration pain.
$NDK/toolchain
(or something).This has the advantage of having the easier migration story. We'll keep both around until we can remove the old one without causing undue pain (in practice this means "until a gradle plugin supporting the new form is available in the stable channel", at which point most other build systems that try to keep up to date have also been fixed). The disadvantage is that it roughly doubles the size of the NDK. I don't have exact numbers right now, but the new layout doesn't need to have an identical libc.a copied into each API level (itself an affordance for old build systems) or duplicate things like make/python. It's still probably a significant size increase.
This saves us some space (
$NDK/toolchains
is about 1GB in r17), but we still need to duplicate platforms and sysroot (about 500MB in r17) as well as libc++ and co (fairly small). The downside is that it will have some rough edges on Windows (our most important host OS, unfortunately). Clang used to require-fuse-ld=gold.exe
(with an extension) on Windows, and anyone that has that would need to change their build files to-fuse-ld=gold.cmd
(or-fuse-ld=gold
, since that works now, either way, the user needs to make a change, not just the build system maintainer). If the new toolchain is instead the source of truth rather than the old binutils location, any scripts that call any of the binaries in that directory (ar and strip being the most likely; the latter would probably break gradle) would need to switch from callingar.exe
and instead callar.cmd
.There's an additional downside here in that using scripts to save space comes at a build-time cost. On Linux/Darwin the cost of
fork
is fairly trivial, butCreateProcess
on Windows has proven to be a fairly tight bottleneck in other parts of Android builds.I personally prefer option 2 since it has the fewest adoption speedbumps, but ~50% install size increase compared to option 3 is not insignificant. I don't think it's worth it, but I could be convinced otherwise if people feel strongly about it (though do remember that the increase is temporary; in a few releases it will be back to its pre-r19 size, plus or minus any unrelated changes).
Implementation
Lifting more default flags (Android-wide requirements, not best practices, probably) into the driver is being tracked as #812.
The text was updated successfully, but these errors were encountered: