summaryrefslogtreecommitdiffstats
path: root/libcxxabi/src
Commit message (Collapse)AuthorAgeFilesLines
* [libcxxabi] Fix layout of __cxa_exception for win64Martin Storsjö2020-02-041-5/+5
| | | | | | | | | | | | Win64 isn't LP64, it's LLP64, but there's no __LLP64__ predefined - just check _WIN64 in addition to __LP64__. This fixes compilation after static asserts about the struct layout were added in f2a436058fcbc11291e73badb44e243f61046183. Differential Revision: https://reviews.llvm.org/D73838 (cherry picked from commit 09dc884eb2e4a433eb8c5ed20a17108091279295)
* [libcxxabi] Insert padding in __cxa_exception struct for compatibilitySteven Wu2020-02-031-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Preserve the old ABI for __cxa_exception and __cxa_dependent_exception on 64 bit platforms or ARM_EHABI platforms. After r276215, libunwind in llvm-project labels _Unwind_Exception to be double word aligned. That change implictly adds a padding before unwindHeader field in __cxa_exception and __cxa_dependent_exception. Preserve the same negative offsets in those struct by moving the padding to the beginning of the field. The assumption here is that if the ABI is not aware of the padding before unwindHeader and put the referenceCount/primaryException in there, no padding should exist before unwindHeader. Reviewers: EricWF, mclow.lists, ldionne, jroelofs, dexonsmith, rjmccall, compnerd, phosek, ahatanak Reviewed By: rjmccall Subscribers: hans, smeenai, kristof.beyls, christof, jkorous, ributzka, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D72543 (cherry picked from commit f2a436058fcbc11291e73badb44e243f61046183)
* [demangle] Copy back some NFC commits from LLVMErik Pilkington2020-01-092-8/+8
|
* [libc++abi] Fix non-constant initialization of default terminateEric Fiselier2019-12-111-6/+8
| | | | handlers.
* [libcxx{,abi}] Emit deplibs only when detected by CMakeMichał Górny2019-12-024-4/+4
| | | | | | | | This is a followup to 35bc5276ca3. It fixes the dependent libs usage in libcxx and libcxxabi to link pthread and rt libraries only if CMake detects them, rather than based on explicit platform blacklist. Differential Revision: https://reviews.llvm.org/D70888
* [demangle] NFC: get rid of NodeOrStringErik Pilkington2019-11-042-63/+19
| | | | | | This class was a bit overengineered, and was triggering some PVS warnings. Instead, put strings into a NameType and let clients unconditionally treat it as a Node.
* [libc++abi] Introduce a LIBCXXABI_LIBRARY_VERSION optionLouis Dionne2019-10-071-1/+1
| | | | | | | | That option controls the 'VERSION' attribute of the libc++abi shared library, which in turn controls the name of the actual dylib being produced. llvm-svn: 373949
* [libc++abi] Do not define -Dcxxabi_shared_EXPORTS when building libc++abiLouis Dionne2019-10-071-1/+3
| | | | | | | CMake sets adds that definition automatically, but we don't need or use it. llvm-svn: 373940
* [libc++abi] Remove redundant link flags on Apple platformsLouis Dionne2019-10-071-18/+1
| | | | | | | | | | | | | | | These flags are already set when we create the cxxabi_shared target using the SOVERSION and VERSION target properties, and the install_name was already being overriden to '@rpath/libc++abi.1.dylib' by CMake because no 'CMAKE_INSTALL_NAME_DIR' option was specified. So this is effectively a removal of dead code with no intended functionality change. The only think we're losing here is that we used to link against libSystem.B.dylib instead of libSystem.dylib when building libc++abi for macOS 10.6 -- however, I strongly suspect nobody's building libc++abi from source for that target anymore. llvm-svn: 373934
* [libc++abi] Link against libSystem on Apple platformsLouis Dionne2019-10-041-3/+8
| | | | | | | | On Apple platforms, libSystem is an umbrella for all other system libraries, and libpthread (and friends) are actually just symlinks to libSystem. llvm-svn: 373770
* [libc++abi] Do not export some implementation-detail functionsLouis Dionne2019-10-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Those functions started being mistakenly exported from the libc++abi shared library after commit r344152 in 2018. Removing these symbols is technically an ABI break. However, they are not part of the C++ ABI, they haven't ever been re-exported from libc++, and they are not declared in any public header, so it's very unlikely that calls to these functions exist out there. Also, the functions have reserved names, so any impacted user would have to have tried really hard being broken by this removal. Note that avoiding this kind of problem is exactly why we're now controlling exported symbols explicitly with a textual list. Also note that applying the hidden visibility attribute is necessary because the list of exported symbols is only used on Apple platforms for the time being. Reviewers: phosek, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D68357 llvm-svn: 373602
* [NFC][libc++abi] Convert stray tabs to spacesLouis Dionne2019-10-022-10/+10
| | | | llvm-svn: 373524
* [libc++abi] Remove uses of C++ headers when possibleLouis Dionne2019-10-017-24/+21
| | | | | | | | | | This reduces the (circular) dependency of libc++abi on a C++ standard library. Outside of the demangler which uses fancier C++ features, the only C++ headers now required by libc++abi are pretty much <new> and <exception>, and that's because libc++abi defines some types that are declared in those headers. llvm-svn: 373381
* [NFC][libc++abi] Remove trailing whitespace from sourcesLouis Dionne2019-10-016-86/+86
| | | | llvm-svn: 373379
* [libc++abi] Remove redundant #include of <string.h>Louis Dionne2019-10-011-20/+14
| | | | | | | <string.h> is always included, so we don't need the additional #include only in the _WIN32 case. llvm-svn: 373365
* [libcxxabi] Fix arm build failer with libgccAdhemerval Zanella2019-09-251-0/+4
| | | | | | | | | | | | | | | | | | | | Both arm32 armv7/armv8 bots which do not use compiler-rt are failing to a linking issue: [100%] Built target cxxabi_static CMakeFiles/cxxabi_shared.dir/cxa_demangle.cpp.o: In function `(anonymous namespace)::itanium_demangle::OutputStream::writeUnsigned(unsigned long long, bool)': /home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:55: undefined reference to `__aeabi_uldivmod' /home/buildslave/buildslave/libcxx-libcxxabi-libunwind-armv7-linux-noexceptions/llvm/projects/libcxxabi/src/demangle/Utility.h:56: undefined reference to `__aeabi_uldivmod' clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) It seems after r371273 OutputStream is used more extensively and is pulling OutputStream::writeUnsigned (which thus requires unsigned integer module). The straightfoward fix is to explicit link against libgcc if compiler-rt is not used. llvm-svn: 372921
* Fix incorrect demangling of call operator of lambda with explicitRichard Smith2019-09-091-4/+0
| | | | | | template parameters due to registering template parameters twice. llvm-svn: 371469
* Simplify demangler rule for lambda-expressions to match discussion onRichard Smith2019-09-091-44/+16
| | | | | | cxx-abi list. llvm-svn: 371462
* Synchronize LLVM's copy of libc++abi's demangler with the libc++abiRichard Smith2019-09-071-1/+2
| | | | | | | | | version after r371273. Also fix a minor issue in r371273 that only surfaced after template instantiation from LLVM's use of the demangler. llvm-svn: 371274
* Implement demangling support for C++20 lambda expression extensions.Richard Smith2019-09-062-29/+417
| | | | | | | | | | | | | | | | | | | | | | | | | This implements demangling support for the mangling extensions specified in https://github.com/itanium-cxx-abi/cxx-abi/pull/85, much of which is implemented in Clang r359967 and r371004. Specifically, this provides demangling for: * <template-param-decl> in <lambda-sig> * <template-param> with non-zero level * lambda-expression literals (not emitted by Clang yet) * nullptr literals * string literals (The final two seem unrelated, but handling them was necessary in order to disambiguate between lambda expressions and the other forms of literal for which we have a type but no value.) When demangling a <lambda-sig>, we form template parameters with no corresponding argument, so we cannot substitute in the argument in the demangling. Instead we invent synthetic names for the template parameters (eg, '[]<typename $T>($T *x)'). llvm-svn: 371273
* [libcxxabi] __cxa_guard_require: test guard byte with != 0 instead of == 1Fangrui Song2019-08-161-1/+1
| | | | llvm-svn: 369109
* libcxxabi: Rename .hpp files to .hNico Weber2019-08-129-14/+14
| | | | | | | | LLVM uses .h as its extension for header files. Differential Revision: https://reviews.llvm.org/D65981 llvm-svn: 368604
* Remove outdated comment about clang not populating src2dst_offsetBenjamin Kramer2019-08-121-1/+0
| | | | | | Clang has been setting this since r174293 (of 2013 vintage). llvm-svn: 368580
* [libc++] Take 2: Integrate the PSTL into libc++Louis Dionne2019-08-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when configuring libc++ in CMake. When that option is enabled, libc++ will assume that the PSTL can be found somewhere on the CMake module path, and it will provide the C++17 parallel algorithms based on the PSTL (that is assumed to be available). The commit also adds support for running the PSTL tests as part of the libc++ test suite. The first attempt to commit this failed because it exposed a bug in the tests for modules. Now that this has been fixed, it should be safe to commit this. Reviewers: EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 llvm-svn: 367903
* [runtimes] Don't depend on libpthread on AndroidYi Kong2019-07-224-4/+4
| | | | | | | | | | r362048 added support for ELF dependent libraries, but broke Android build since Android does not have libpthread. Remove the dependency on the Android build. Differential Revision: https://reviews.llvm.org/D65098 llvm-svn: 366734
* Revert "[libc++] Integrate the PSTL into libc++"Louis Dionne2019-07-191-11/+0
| | | | | | | This reverts r366593, which caused unforeseen breakage on the build bots. I'm reverting until the problems have been figured out and fixed. llvm-svn: 366603
* [libc++] Integrate the PSTL into libc++Louis Dionne2019-07-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when configuring libc++ in CMake. When that option is enabled, libc++ will assume that the PSTL can be found somewhere on the CMake module path, and it will provide the C++17 parallel algorithms based on the PSTL (that is assumed to be available). The commit also adds support for running the PSTL tests as part of the libc++ test suite. Reviewers: rodgert, EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF Tags: #libc Differential Revision: https://reviews.llvm.org/D60480 llvm-svn: 366593
* [libcxxabi] Don't process exceptions in cxa_handlers when they're disabledPetr Hosek2019-07-122-0/+4
| | | | | | | | | | | When exceptions are disabled, avoid their processing altogether. This avoids pulling in the depenency on demangler significantly reducing binary size when statically linking against libc++abi built without exception support. Differential Revision: https://reviews.llvm.org/D64191 llvm-svn: 365944
* [demangle] Support for C++2a char8_tErik Pilkington2019-06-281-0/+4
| | | | llvm-svn: 364677
* [libcxxabi] Use an explicit list to export symbols from the dylibLouis Dionne2019-06-271-0/+21
| | | | | | | | | | | | Reviewers: EricWF Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D63345 llvm-svn: 364586
* [demangle] Special case clang's creative mangling of __uuidof expressions.Erik Pilkington2019-06-181-0/+31
| | | | llvm-svn: 363752
* [demangle] Vendor extended types shouldn't be considered substitution candidatesErik Pilkington2019-06-101-1/+5
| | | | llvm-svn: 362983
* [libcxx] Use libtool when merging archives on Apple platformsPetr Hosek2019-06-021-0/+5
| | | | | | | | | | ar doesn't produce the correct results when used for linking static archives on Apple platforms, so instead use libtool -static which is the official way to build static archives on those platforms. Differential Revision: https://reviews.llvm.org/D62770 llvm-svn: 362311
* [runtimes] Check if pragma comment(lib, ...) is supported firstPetr Hosek2019-05-304-3/+7
| | | | | | | | | This fixes the issue introduced by r362048 where we always use pragma comment(lib, ...) for dependent libraries when the compiler is Clang, but older Clang versions don't support this pragma so we need to check first if it's supported before using it. llvm-svn: 362055
* [runtimes] Support ELF dependent libraries featurePetr Hosek2019-05-303-0/+16
| | | | | | | | | | | | | | | | | | | As of r360984, LLD supports dependent libraries feature for ELF. libunwind, libc++abi and libc++ have library dependencies: libdl librt and libpthread, which means that when libunwind and libc++ are being statically linked (using -static-libstdc++ flag), user has to manually specify -ldl -lpthread which is onerous. This change includes the lib pragma to specify the library dependencies directly in the source that uses those libraries. This doesn't make any difference when using linkers that don't support dependent libraries. However, when using LLD that has dependent libraries feature, users no longer have to manually specifying library dependencies when using static linking, linker will pick the library automatically. Differential Revision: https://reviews.llvm.org/D62090 llvm-svn: 362048
* Update private_typeinfo's `is_equal` implementation after r361913Eric Fiselier2019-05-291-7/+5
| | | | | | | | | | | | | | The libc++ typeinfo implementation is being improved to better handle non-merged type names. This patch takes advantage of that more correct behavior by delegating to std::type_infos default operator== instead of doing pointer equality ourselves. However, libc++ still expects unique RTTI by default, and so we should still fall back to strcmp when explicitly requested. llvm-svn: 361916
* [runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and ↵Petr Hosek2019-05-221-2/+2
| | | | | | | | | | | | | | | | | include/c++ This change is a consequence of the discussion in "RFC: Place libs in Clang-dedicated directories", specifically the suggestion that libunwind, libc++abi and libc++ shouldn't be using Clang resource directory. Tools like clangd make this assumption, but this is currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build. This change addresses that by moving the output of these libraries to lib/$target/c++ and include/c++ directories, leaving resource directory only for compiler-rt runtimes and Clang builtin headers. Differential Revision: https://reviews.llvm.org/D59168 llvm-svn: 361432
* minor cmake formatting style fixNico Weber2019-05-071-1/+3
| | | | llvm-svn: 360142
* [libcxxabi] Don't use -fvisibility-global-new-delete-hidden when not ↵Petr Hosek2019-05-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | defining them When builing the hermetic static library, the compiler switch -fvisibility-global-new-delete-hidden is necessary to get the new and delete operator definitions made correctly. However, when those definitions are not included in the library, then this switch does harm. With lld (though not all linkers) setting STV_HIDDEN on SHN_UNDEF symbols makes it an error to leave them undefined or defined via dynamic linking that should generate PLTs for -shared linking (lld makes this a hard error even without -z defs). Though leaving the symbols undefined would usually work in practice if the linker were to allow it (and the user didn't pass -z defs), this actually indicates a real problem that could bite some target configurations more subtly at runtime. For example, x86-32 ELF -fpic code generation uses hidden visibility on declarations in the caller's scope as a signal that the call will never be resolved to a PLT entry and so doesn't have to meet the special ABI requirements for PLT calls (setting %ebx). Since these functions might actually be resolved to PLT entries at link time (we don't know what the user is linking in when the hermetic library doesn't provide all the symbols itself), it's not safe for the compiler to treat their declarations at call sites as having hidden visibility. Differential Revision: https://reviews.llvm.org/D61572 llvm-svn: 360004
* [gn] Support for building libcxxabiPetr Hosek2019-05-021-4/+10
| | | | | | | | | | | | This change introduces support for building libcxxabi. The library build should be complete, but not all CMake options have been replicated in GN. We also don't support tests yet. We only support two stage build at the moment. Differential Revision: https://reviews.llvm.org/D60372 llvm-svn: 359805
* Update DemangleConfig.h to better mangle LLVM's version.Eric Fiselier2019-04-301-12/+68
| | | | | | | There's no need for the demangling bits to depend on libc++ internals, in the same way they don't when compiled as part of LLVM. llvm-svn: 359534
* Fix compilation error with -DLIBCXXABI_ENABLE_THREADS=OFFMichael Platings2019-04-251-0/+3
| | | | | | | | | | | | The error is: libcxxabi/src/cxa_guard_impl.h: In instantiation of ‘__cxxabiv1::{anonymous}::LibcppMutex __cxxabiv1::{anonymous}::GlobalStatic<__cxxabiv1::{anonymous}::LibcppMutex>::instance’: libcxxabi/src/cxa_guard_impl.h:529:62: required from here libcxxabi/src/cxa_guard_impl.h:510:23: error: ‘__cxxabiv1::{anonymous}::LibcppMutex __cxxabiv1::{anonymous}::GlobalStatic<__cxxabiv1::{anonymous}::LibcppMutex>::instance’ has incomplete type _LIBCPP_SAFE_STATIC T GlobalStatic<T>::instance = {}; ^ llvm-svn: 359175
* Cleanup new cxa guard implementation.Eric Fiselier2019-04-241-4/+13
| | | | | | | | * Add TSAN annotations around the futex syscalls. * Test that the futex syscall wrappers actually work. * Fix bad names. llvm-svn: 359069
* Rewrite cxa guard implementation.Eric Fiselier2019-04-243-263/+595
| | | | | | | | | | | | | This patch does three main things: (1) It re-writes the cxa guard implementation to make it testable. (2) Adds support for recursive init detection on non-apple platforms. (3) It adds a futex based implementation. The futex based implementation locks and notifies on a per-object basis, unlike the current implementation which uses a global lock for all objects. Once this patch settles I'll turn it on by default when supported. llvm-svn: 359060
* Fix PR41465 - Use __builtin_mul_overflow instead of hand-rolled check.Eric Fiselier2019-04-111-4/+29
| | | | | | | | | On ARM the hand-rolled check causes a call to __aeabi_uidiv, which we may not have a definition for. Using the builtin avoids the generation of any library call. llvm-svn: 358195
* [NFC] Correct outdated links to the Itanium C++ ABI documentationLouis Dionne2019-04-117-7/+7
| | | | | | | | Those are now hosted on GitHub. rdar://problem/36557462 llvm-svn: 358191
* [libc++abi] Create a macro for the 32 bit guard setting on ARM platformsLouis Dionne2019-04-101-10/+10
| | | | | | | | | | | | | | | | Summary: The goal is to use a descriptive name for this feature, instead of just using __arm__. Reviewers: EricWF Subscribers: javed.absar, kristof.beyls, christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D60520 llvm-svn: 358106
* Revert "Make reads and writes of the guard variable atomic."Eric Fiselier2019-04-081-33/+19
| | | | | | | | | | This reverts commit r357944 and r357949. These changes failed to account for the fact that the guard object is under aligned for atomic operations on 32 bit platforms (It's aligned to 4 bytes but we require 8). llvm-svn: 357958
* Fix incorrect change during refactoring.Eric Fiselier2019-04-081-1/+1
| | | | | | cxa_guard_abort should still broadcast on exit. llvm-svn: 357956
* Remove unneeded write in __cxa_guard_release.Eric Fiselier2019-04-081-1/+0
| | | | | | | The INIT_COMPLETE write now writes to the entire guard object instead of just one byte. llvm-svn: 357949
OpenPOWER on IntegriCloud