Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 1 | .. _index: |
| 2 | |
| 3 | ============================= |
| 4 | "libc++" C++ Standard Library |
| 5 | ============================= |
| 6 | |
| 7 | Overview |
| 8 | ======== |
| 9 | |
Mehdi Amini | 032f15a | 2017-01-25 17:00:30 +0000 | [diff] [blame] | 10 | libc++ is a new implementation of the C++ standard library, targeting C++11 and |
| 11 | above. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 12 | |
| 13 | * Features and Goals |
| 14 | |
| 15 | * Correctness as defined by the C++11 standard. |
| 16 | * Fast execution. |
| 17 | * Minimal memory use. |
| 18 | * Fast compile times. |
| 19 | * ABI compatibility with gcc's libstdc++ for some low-level features |
| 20 | such as exception objects, rtti and memory allocation. |
| 21 | * Extensive unit tests. |
| 22 | |
| 23 | * Design and Implementation: |
| 24 | |
| 25 | * Extensive unit tests |
| 26 | * Internal linker model can be dumped/read to textual format |
| 27 | * Additional linking features can be plugged in as "passes" |
| 28 | * OS specific and CPU specific code factored out |
| 29 | |
| 30 | |
| 31 | Getting Started with libc++ |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 32 | =========================== |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 33 | |
| 34 | .. toctree:: |
Louis Dionne | 4b1b70d | 2021-07-06 10:39:01 -0400 | [diff] [blame] | 35 | :maxdepth: 1 |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 36 | |
Louis Dionne | 743b1c0 | 2018-09-06 15:05:43 +0000 | [diff] [blame] | 37 | ReleaseNotes |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 38 | UsingLibcxx |
| 39 | BuildingLibcxx |
| 40 | TestingLibcxx |
Marek Kurdej | d5bc4d9 | 2020-12-02 08:52:35 +0100 | [diff] [blame] | 41 | Contributing |
Louis Dionne | e96350d | 2021-07-06 09:46:29 -0400 | [diff] [blame] | 42 | Status/Cxx14 |
| 43 | Status/Cxx17 |
| 44 | Status/Cxx20 |
| 45 | Status/Cxx2b |
Louis Dionne | e96350d | 2021-07-06 09:46:29 -0400 | [diff] [blame] | 46 | Status/Format |
Kent Ross | 3b4b6c9 | 2021-08-19 23:10:47 +0000 | [diff] [blame] | 47 | Status/Ranges |
| 48 | Status/Spaceship |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 49 | |
Eric Fiselier | a28db90 | 2015-09-05 05:29:23 +0000 | [diff] [blame] | 50 | |
Eric Fiselier | 4e86049 | 2019-01-16 01:37:43 +0000 | [diff] [blame] | 51 | .. toctree:: |
| 52 | :hidden: |
| 53 | |
Louis Dionne | f34ac04 | 2020-11-19 14:22:28 -0500 | [diff] [blame] | 54 | AddingNewCIJobs |
Eric Fiselier | 4e86049 | 2019-01-16 01:37:43 +0000 | [diff] [blame] | 55 | FeatureTestMacroTable |
| 56 | |
Louis Dionne | f34ac04 | 2020-11-19 14:22:28 -0500 | [diff] [blame] | 57 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 58 | Current Status |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 59 | ============== |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 60 | |
| 61 | After its initial introduction, many people have asked "why start a new |
| 62 | library instead of contributing to an existing library?" (like Apache's |
| 63 | libstdcxx, GNU's libstdc++, STLport, etc). There are many contributing |
| 64 | reasons, but some of the major ones are: |
| 65 | |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 66 | * From years of experience (including having implemented the standard |
| 67 | library before), we've learned many things about implementing |
| 68 | the standard containers which require ABI breakage and fundamental changes |
| 69 | to how they are implemented. For example, it is generally accepted that |
| 70 | building std::string using the "short string optimization" instead of |
| 71 | using Copy On Write (COW) is a superior approach for multicore |
| 72 | machines (particularly in C++11, which has rvalue references). Breaking |
| 73 | ABI compatibility with old versions of the library was |
| 74 | determined to be critical to achieving the performance goals of |
| 75 | libc++. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 76 | |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 77 | * Mainline libstdc++ has switched to GPL3, a license which the developers |
| 78 | of libc++ cannot use. libstdc++ 4.2 (the last GPL2 version) could be |
| 79 | independently extended to support C++11, but this would be a fork of the |
| 80 | codebase (which is often seen as worse for a project than starting a new |
| 81 | independent one). Another problem with libstdc++ is that it is tightly |
| 82 | integrated with G++ development, tending to be tied fairly closely to the |
| 83 | matching version of G++. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 84 | |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 85 | * STLport and the Apache libstdcxx library are two other popular |
| 86 | candidates, but both lack C++11 support. Our experience (and the |
| 87 | experience of libstdc++ developers) is that adding support for C++11 (in |
| 88 | particular rvalue references and move-only types) requires changes to |
| 89 | almost every class and function, essentially amounting to a rewrite. |
| 90 | Faced with a rewrite, we decided to start from scratch and evaluate every |
| 91 | design decision from first principles based on experience. |
| 92 | Further, both projects are apparently abandoned: STLport 5.2.1 was |
| 93 | released in Oct'08, and STDCXX 4.2.1 in May'08. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 94 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 95 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 96 | Platform and Compiler Support |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 97 | ============================= |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 98 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 99 | Libc++ aims to support common compilers that implement the C++11 Standard. In order to strike a |
| 100 | good balance between stability for users and maintenance cost, testing coverage and development |
| 101 | velocity, libc++ drops support for older compilers as newer ones are released. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 102 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 103 | ============ =============== ========================== ===================== |
| 104 | Compiler Versions Restrictions Support policy |
| 105 | ============ =============== ========================== ===================== |
Mark de Wever | d535299 | 2021-10-23 13:08:01 +0200 | [diff] [blame] | 106 | Clang 12, 13 latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_ |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 107 | AppleClang 12 latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_ |
David Tenty | 7723593 | 2021-10-19 14:09:46 -0400 | [diff] [blame] | 108 | Open XL 17.1 (AIX) latest stable release per `Open XL's documentation page <https://www.ibm.com/docs/en/openxl-c-and-cpp-aix>`_ |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 109 | GCC 11 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_ |
| 110 | ============ =============== ========================== ===================== |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 111 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 112 | Libc++ also supports common platforms and architectures: |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 113 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 114 | =============== ========================= ============================ |
| 115 | Target platform Target architecture Notes |
| 116 | =============== ========================= ============================ |
| 117 | macOS 10.9+ i386, x86_64, arm64 Building the shared library itself requires targetting macOS 10.11+ |
| 118 | FreeBSD 10+ i386, x86_64, arm |
| 119 | Linux i386, x86_64, arm, arm64 |
Martin Storsjö | e208154 | 2021-10-01 23:08:57 +0300 | [diff] [blame] | 120 | Windows x86_64 Both MSVC and MinGW style environments |
David Tenty | 7723593 | 2021-10-19 14:09:46 -0400 | [diff] [blame] | 121 | AIX powerpc, powerpc64 |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 122 | =============== ========================= ============================ |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 123 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 124 | Generally speaking, libc++ should work on any platform that provides a fairly complete |
| 125 | C Standard Library. It is also possible to turn off parts of the library for use on |
| 126 | systems that provide incomplete support. |
Louis Dionne | 678dc85 | 2020-02-12 17:01:19 +0100 | [diff] [blame] | 127 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 128 | However, libc++ aims to provide a high-quality implementation of the C++ Standard |
| 129 | Library, especially when it comes to correctness. As such, we aim to have test coverage |
| 130 | for all the platforms and compilers that we claim to support. If a platform or compiler |
Martin Storsjö | e9747ef | 2021-07-13 14:24:51 +0300 | [diff] [blame] | 131 | is not listed here, it is not officially supported. It may happen to work, and |
| 132 | in practice the library is known to work on some platforms not listed here, but |
| 133 | we don't make any guarantees. If you would like your compiler and/or platform |
Louis Dionne | 4969615 | 2021-08-17 10:52:12 -0400 | [diff] [blame] | 134 | to be formally supported and listed here, please work with the libc++ team to set |
| 135 | up testing for your configuration. |
Louis Dionne | 678dc85 | 2020-02-12 17:01:19 +0100 | [diff] [blame] | 136 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 137 | |
| 138 | C++ Dialect Support |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 139 | =================== |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 140 | |
| 141 | * C++11 - Complete |
Louis Dionne | e96350d | 2021-07-06 09:46:29 -0400 | [diff] [blame] | 142 | * :ref:`C++14 - Complete <cxx14-status>` |
| 143 | * :ref:`C++17 - In Progress <cxx17-status>` |
| 144 | * :ref:`C++20 - In Progress <cxx20-status>` |
Mark de Wever | 8b38f96 | 2021-01-22 19:03:14 +0100 | [diff] [blame] | 145 | * :ref:`C++2b - In Progress <cxx2b-status>` |
Eric Fiselier | 4e86049 | 2019-01-16 01:37:43 +0000 | [diff] [blame] | 146 | * :ref:`C++ Feature Test Macro Status <feature-status>` |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 147 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 148 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 149 | Notes and Known Issues |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 150 | ====================== |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 151 | |
| 152 | This list contains known issues with libc++ |
| 153 | |
| 154 | * Building libc++ with ``-fno-rtti`` is not supported. However |
| 155 | linking against it with ``-fno-rtti`` is supported. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 156 | |
| 157 | |
Eric Fiselier | a72fd80 | 2015-09-06 23:22:02 +0000 | [diff] [blame] | 158 | A full list of currently open libc++ bugs can be `found here`__. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 159 | |
Eric Fiselier | 5d60401 | 2017-02-17 08:37:03 +0000 | [diff] [blame] | 160 | .. __: https://bugs.llvm.org/buglist.cgi?component=All%20Bugs&product=libc%2B%2B&query_format=advanced&resolution=---&order=changeddate%20DESC%2Cassigned_to%20DESC%2Cbug_status%2Cpriority%2Cbug_id&list_id=74184 |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 161 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 162 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 163 | Design Documents |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 164 | ================ |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 165 | |
Eric Fiselier | 5cf9a82 | 2015-10-13 22:12:02 +0000 | [diff] [blame] | 166 | .. toctree:: |
| 167 | :maxdepth: 1 |
| 168 | |
Eric Fiselier | 1a1c74b | 2015-10-14 00:22:05 +0000 | [diff] [blame] | 169 | DesignDocs/ABIVersioning |
Louis Dionne | 0df08db | 2021-06-08 11:15:27 -0400 | [diff] [blame] | 170 | DesignDocs/AtomicDesign |
| 171 | DesignDocs/CapturingConfigInfo |
| 172 | DesignDocs/DebugMode |
Louis Dionne | 3767713 | 2019-06-11 14:48:40 +0000 | [diff] [blame] | 173 | DesignDocs/ExperimentalFeatures |
Eric Fiselier | f995453 | 2019-06-11 22:53:49 +0000 | [diff] [blame] | 174 | DesignDocs/ExtendedCXX03Support |
Louis Dionne | 0df08db | 2021-06-08 11:15:27 -0400 | [diff] [blame] | 175 | DesignDocs/FeatureTestMacros |
| 176 | DesignDocs/FileTimeType |
zoecarver | 08de816 | 2021-02-05 11:24:38 -0800 | [diff] [blame] | 177 | DesignDocs/NoexceptPolicy |
Louis Dionne | 0df08db | 2021-06-08 11:15:27 -0400 | [diff] [blame] | 178 | DesignDocs/ThreadingSupportAPI |
| 179 | DesignDocs/UniquePtrTrivialAbi |
Danila Kutenin | a9cbea1 | 2021-11-16 15:48:59 -0500 | [diff] [blame] | 180 | DesignDocs/UnspecifiedBehaviorRandomization |
Louis Dionne | 0df08db | 2021-06-08 11:15:27 -0400 | [diff] [blame] | 181 | DesignDocs/VisibilityMacros |
Eric Fiselier | 5cf9a82 | 2015-10-13 22:12:02 +0000 | [diff] [blame] | 182 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 183 | |
Eric Fiselier | 44451cb | 2015-10-15 03:27:02 +0000 | [diff] [blame] | 184 | Build Bots and Test Coverage |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 185 | ============================ |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 186 | |
Louis Dionne | f34ac04 | 2020-11-19 14:22:28 -0500 | [diff] [blame] | 187 | * `Buildkite CI pipeline <https://buildkite.com/llvm-project/libcxx-ci>`_ |
| 188 | * `LLVM Buildbot Builders <http://lab.llvm.org:8011>`_ |
| 189 | * :ref:`Adding New CI Jobs <AddingNewCIJobs>` |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 190 | |
Louis Dionne | f5cd4c7 | 2021-07-06 15:47:29 -0400 | [diff] [blame] | 191 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 192 | Getting Involved |
| 193 | ================ |
| 194 | |
Sylvestre Ledru | b09c938 | 2020-03-22 22:42:03 +0100 | [diff] [blame] | 195 | First please review our `Developer's Policy <https://llvm.org/docs/DeveloperPolicy.html>`__ |
| 196 | and `Getting started with LLVM <https://llvm.org/docs/GettingStarted.html>`__. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 197 | |
| 198 | **Bug Reports** |
| 199 | |
| 200 | If you think you've found a bug in libc++, please report it using |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 201 | the `LLVM Bugzilla`_. If you're not sure, you |
Eric Fiselier | fa90b7f | 2018-09-22 19:49:29 +0000 | [diff] [blame] | 202 | can post a message to the `libcxx-dev mailing list`_ or on IRC. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 203 | |
| 204 | **Patches** |
| 205 | |
| 206 | If you want to contribute a patch to libc++, the best place for that is |
Sylvestre Ledru | b09c938 | 2020-03-22 22:42:03 +0100 | [diff] [blame] | 207 | `Phabricator <https://llvm.org/docs/Phabricator.html>`_. Please add `libcxx-commits` as a subscriber. |
Eric Fiselier | fa90b7f | 2018-09-22 19:49:29 +0000 | [diff] [blame] | 208 | Also make sure you are subscribed to the `libcxx-commits mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-commits>`_. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 209 | |
| 210 | **Discussion and Questions** |
| 211 | |
Eric Fiselier | 4f9062a | 2015-09-06 23:09:54 +0000 | [diff] [blame] | 212 | Send discussions and questions to the |
Eric Fiselier | fa90b7f | 2018-09-22 19:49:29 +0000 | [diff] [blame] | 213 | `libcxx-dev mailing list <http://lists.llvm.org/mailman/listinfo/libcxx-dev>`_. |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 214 | |
Eric Fiselier | d720d1f | 2015-08-22 19:40:49 +0000 | [diff] [blame] | 215 | |
Eric Fiselier | 98596ba | 2015-09-05 06:50:03 +0000 | [diff] [blame] | 216 | Quick Links |
| 217 | =========== |
Sylvestre Ledru | b09c938 | 2020-03-22 22:42:03 +0100 | [diff] [blame] | 218 | * `LLVM Homepage <https://llvm.org/>`_ |
Eric Fiselier | 4f9062a | 2015-09-06 23:09:54 +0000 | [diff] [blame] | 219 | * `libc++abi Homepage <http://libcxxabi.llvm.org/>`_ |
Eric Fiselier | 5d60401 | 2017-02-17 08:37:03 +0000 | [diff] [blame] | 220 | * `LLVM Bugzilla <https://bugs.llvm.org/>`_ |
Eric Fiselier | fa90b7f | 2018-09-22 19:49:29 +0000 | [diff] [blame] | 221 | * `libcxx-commits Mailing List`_ |
| 222 | * `libcxx-dev Mailing List`_ |
xgupta | 482d587 | 2021-02-01 12:54:21 +0530 | [diff] [blame] | 223 | * `Browse libc++ Sources <https://github.com/llvm/llvm-project/tree/main/libcxx/>`_ |