summaryrefslogtreecommitdiffstats
path: root/libcxxabi/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Make reads and writes of the guard variable atomic.Eric Fiselier2019-04-081-19/+34
| | | | | | | | | | | | | | | | | | The read of the guard variable by the caller is atomic, and doesn't happen under a mutex. Our internal reads and writes were non-atomic, because they happened under a mutex. The writes should always be atomic since they can be observed outside of the lock. Making the reads atomic is not strictly necessary under the current global mutex approach, but will be under implementations that use a futex (which I plan to land shortly). However, they should add little additional cost. llvm-svn: 357944
* Fix PR41395 - __cxa_vec_new may overflow in allocation size calculation.Eric Fiselier2019-04-051-13/+43
| | | | llvm-svn: 357814
* Further refactor cxa_guard.cppEric Fiselier2019-04-051-144/+176
| | | | | | | | | | | | | | | | | | This patch is a part of a series of patches to cleanup our implementation of __cxa_acquire et al. No functionality change was intended. This patch does two primary things. It introduces the GuardObject class to abstract the reading and writing to the guard object. In future, it will be used to ensure atomic accesses are used when needed. It also introduces the GuardValue class used to represent values of the guard object. It is an abstraction to access and write to the various different bits of a guard. llvm-svn: 357804
* Create RAII lock guard for global initialization lock.Eric Fiselier2019-04-041-81/+94
| | | | | | | | | | | | This patch is a part of a series of cleanups to cxa_guard.cpp. It should introduce no functionality change. This patch refactors the use of the global mutex and condvar into a RAII lock guard class. This improves correctness (since unlocks can't be forgotten). It also allows the unification of the non-threading and threading implementations. llvm-svn: 357669
* Always use is_initialized and set_initialized in cxa_guard.cppEric Fiselier2019-04-041-16/+8
| | | | | | | This patch is part of a series of cleanups to cxa_guard.cpp. It should have no functionality change. llvm-svn: 357668
* llvm-cxxfilt: Demangle gcc "old-style unified" ctors and dtorsNico Weber2019-04-031-7/+10
| | | | | | | | | | | These are variant 4, cf https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1851 https://github.com/gcc-mirror/gcc/blob/master/gcc/cp/mangle.c#L1880 and gcc seems to sometimes emit them still. Differential Revision: https://reviews.llvm.org/D60229 llvm-svn: 357645
* [libc++abi] Do not share an object library to create the static/shared librariesPetr Hosek2019-04-031-59/+39
| | | | | | | | | | | | | This change is similar to r356150, with the same motivation. The only difference is that the method used to merge libunwind.a and libc++abi.a had to be changed to use the same approach as libc++ since we no longer produce object libraries that could be linked together as we did before. We reuse the libc++ script for merging archives to avoid duplication between the two projects. Differential Revision: https://reviews.llvm.org/D60173 llvm-svn: 357635
* [libc++abi] Add LIBCXXABI_ENABLE_PIC cmake optionSam Clegg2019-04-031-1/+4
| | | | | | | | | | | | | | | This is on by default, since on many platforms and configurations libc++abi.a gets statically linked into shared libraries and/or PIE executables. This change is a followup to https://reviews.llvm.org/D60005 which allows us to default to PIC code, but disable this if needed (for example on WebAssembly where PIC code its currently compatible with static linking). Differential Revision: https://reviews.llvm.org/D60049 llvm-svn: 357551
* [libc++abi] Actually set POSITION_INDEPENDENT_CODE when building shared librarySam Clegg2019-04-031-1/+3
| | | | | | | | This is a bug fix from https://reviews.llvm.org/D60005. Differential Revision: https://reviews.llvm.org/D60158 llvm-svn: 357550
* [libc++abi] Don't set POSITION_INDEPENDENT_CODE when building static librarySam Clegg2019-03-291-12/+7
| | | | | | | | | | | | | With the current WebAssembly backend, objects built with -fPIC are not compatible with static linking. libc++abi was (mistakenly?) adding -fPIC to the objects it was including in a static library. IIUC this change should also mean the static build can be more efficient on all platforms. Differential Revision: https://reviews.llvm.org/D60005 llvm-svn: 357322
* Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"Matthew Voss2019-03-081-2/+2
| | | | | | | | This broke the windows bots. This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0. llvm-svn: 355725
* [runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/Petr Hosek2019-03-081-2/+2
| | | | | | | | | | | | | | | 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> and include/ directories, leaving resource directory only for compiler-rt runtimes and Clang builtin headers. Differential Revision: https://reviews.llvm.org/D59013 llvm-svn: 355665
* [libc++abi] Specify unwind lib before other system libraries when linkingLouis Dionne2019-03-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This matters on OSX because static linking orders is also the order dyld uses to search for libs (the default - Two-level namespace). If system libs (including unwind lib) are specified before local unwind lib, local unwind lib would never be picked up by dyld. Before: $ otool -L lib/libc++abi.dylib @rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5) @rpath/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0) After: $ otool -L lib/libc++abi.dylib @rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0) @rpath/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5) Thanks to Yuanfang Chen for the patch. Differential Revision: https://reviews.llvm.org/D57496 llvm-svn: 355241
* [CMake] Use correct visibility for linked libraries in CMakePetr Hosek2019-01-301-2/+2
| | | | | | | | | | | When linking library dependencies, we shouldn't need to export linked libraries to dependents. We should be explicit about this in target_link_libraries, otherwise other targets that depend on these such as sanitizers get repeated (and possibly even conflicting) dependencies. Differential Revision: https://reviews.llvm.org/D57456 llvm-svn: 352688
* Revert "[CMake] Use correct visibility for linked libraries in CMake"Petr Hosek2019-01-301-2/+2
| | | | | | This reverts commit r352654: this broke libcxx and sanitizer bots. llvm-svn: 352658
* [CMake] Use correct visibility for linked libraries in CMakePetr Hosek2019-01-301-2/+2
| | | | | | | | | | | When linking library dependencies, we shouldn't need to export linked libraries to dependents. We should be explicit about this in target_link_libraries, otherwise other targets that depend on these such as sanitizers get repeated (and possibly even conflicting) dependencies. Differential Revision: https://reviews.llvm.org/D57456 llvm-svn: 352654
* [libunwind] Support building hermetic static libraryPetr Hosek2019-01-291-1/+5
| | | | | | | | | | | | | | | This is useful when the static libunwind library is being linked into shared libraries that may be used in with other shared libraries that use different unwinder. We want to avoid avoid exporting libunwind symbols in those cases. This achieved by a new CMake option which can be enabled by libunwind vendors as needed. The same CMake option has already been added to libc++ and libc++abi in D55404 and D56026. Differential Revision: https://reviews.llvm.org/D57107 llvm-svn: 352559
* [libcxxabi] Support building hermetic static libraryPetr Hosek2019-01-241-16/+44
| | | | | | | | | | | | This is useful when the static libc++abi library is being linked into shared libraries that may be used in with other shared libraries that use different C++ library. We want to avoid avoid exporting libc++abi or libc++ symbols in those cases. This achieved by a new CMake option which can be enabled by libc++abi vendors as needed. Differential Revision: https://reviews.llvm.org/D56026 llvm-svn: 352017
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1928-112/+84
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-193-12/+9
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [demangler] Support for block literals.Erik Pilkington2019-01-171-0/+6
| | | | llvm-svn: 351482
* [demangler] Ignore leading underscores if presentErik Pilkington2019-01-171-2/+2
| | | | | | | On MacOS, symbols start with a leading underscore, so just parse and ignore it if present. llvm-svn: 351481
* NFC: Make the copies of the demangler byte-for-byte identicalErik Pilkington2019-01-177-36/+147
| | | | | | | | | | | | | | With this patch, the copies of the files ItaniumDemangle.h, StringView.h, and Utility.h are kept byte-for-byte in sync between libcxxabi and llvm. All differences (namespaces, fallthrough, and unreachable macros) are defined in each copies' DemanglerConfig.h. This patch also adds a script to copy changes from libcxxabi (cp-to-llvm.sh), and a README.txt explaining the situation. Differential revision: https://reviews.llvm.org/D53538 llvm-svn: 351474
* [libcxx] Remove bad_array_lengthLouis Dionne2018-11-291-30/+0
| | | | | | | | | | | | | | | | Summary: std::bad_array_length was added by n3467, but this never made it into C++. This commit removes the definition of std::bad_array_length from the headers AND from the shared library. See the comments in the ABI changelog for details about the ABI implications of this change. Reviewers: mclow.lists, dexonsmith, howard.hinnant, EricWF Subscribers: christof, jkorous, libcxx-commits Differential Revision: https://reviews.llvm.org/D54804 llvm-svn: 347903
* [Demangle] remove itaniumFindTypesInMangledNamePavel Labath2018-11-271-6/+0
| | | | | | | | | | | | | | | | Summary: This (very specialized) function was added to enable an LLDB use case. Now that a more generic interface (overriding of parser functions - D52992) is available, and LLDB has been converted to use that (D54074), the function is unused and can be removed. Reviewers: erik.pilkington, sgraenitz, rsmith Subscribers: mgorny, hiraditya, christof, libcxx-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D54893 llvm-svn: 347670
* Port LLVM r346606 to libcxxabi.Nico Weber2018-11-112-3/+3
| | | | llvm-svn: 346607
* Use C++11 fallthrough attribute syntax when available and add a breakReid Kleckner2018-11-011-0/+1
| | | | | | | | | | | | | | | | | | | Summary: This silences the two -Wimplicit-fallthrough warnings clang finds in ItaniumDemangle.h in libc++abi. Clang does not have a GNU attribute spelling for this attribute, so this is necessary. I will commit the same change to the LLVM demangler soon. Reviewers: EricWF, ldionne Subscribers: christof, erik.pilkington, cfe-commits Differential Revision: https://reviews.llvm.org/D53985 llvm-svn: 345870
* [libc++abi] Provide __cxa_thread_atexit on FuchsiaPetr Hosek2018-10-291-1/+1
| | | | | | | | Fuchsia already supports this interface. Differential Revision: https://reviews.llvm.org/D53801 llvm-svn: 345534
* cxa_demangle: make demangler's parsing functions overridablePavel Labath2018-10-162-303/+363
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This uses CRTP (for performance reasons) to allow a user the override demangler functions to implement custom parsing logic. The motivation for this is LLDB, which needs to occasionaly modify the mangled names. One such instance is already implemented via the TypeCallback member, but this is very specific functionality which does not help with any other use case. Currently we have a use case for modifying the constructor flavours, which would require adding another callback. This approach does not scale. With CRTP, the user (LLDB) can override any function it needs without any special support from the demangler library. After LLDB is ported to use this instead of the TypeCallback mechanism, the callback can be removed. More context can be found in D50599. Reviewers: erik.pilkington, rsmith Subscribers: christof, ldionne, llvm-commits, libcxx-commits Differential Revision: https://reviews.llvm.org/D52992 llvm-svn: 344607
* NFC: Fix a -Wsign-conversion warningErik Pilkington2018-10-151-5/+11
| | | | llvm-svn: 344564
* Override libcxxabi's .clang-format in the demangle directoryErik Pilkington2018-10-111-0/+2
| | | | | | This directory uses LLVM style. llvm-svn: 344316
* Use C++03 friendly version of alignofEric Fiselier2018-10-111-1/+1
| | | | llvm-svn: 344215
* Update libc++abi's detection of aligned allocation after r344207.Eric Fiselier2018-10-112-4/+4
| | | | llvm-svn: 344208
* [libcxxabi] Allow building with sanitizers enabledLouis Dionne2018-10-101-0/+25
| | | | | | | | | | | | | | | Summary: I copied the sanitizer-related logic in libcxx/lib/CMakeLists.txt. In the future, it would be great to avoid duplicating this logic in the compiler, libc++ and libc++abi. Reviewers: EricWF Subscribers: mgorny, christof, dexonsmith, libcxx-commits, davide Differential Revision: https://reviews.llvm.org/D53028 llvm-svn: 344191
* Blind attempt to fix linker errors when building libc++abit w/o exceptions.Marshall Clow2018-10-101-0/+5
| | | | llvm-svn: 344156
* Make libc++abi work better with gcc's ARM unwind library. Reviewed as ↵Marshall Clow2018-10-105-34/+42
| | | | | | https://reviews.llvm.org/D42242 llvm-svn: 344152
* Port llvm r342166 to libcxxabi demanglerPavel Labath2018-10-101-19/+16
| | | | | | | | | | | | | | | | | | | | Summary: This was committed back in september (D51463), but it seems it never made it into the libcxxabi copy. The original commit message was: The hash computed for an ArrayType was different when first constructed versus when later profiled due to the constructor default argument, and we were not tracking constructor / destructor variant as part of the mangled name AST, leading to incorrect equivalences. Reviewers: erik.pilkington, rsmith, EricWF Subscribers: christof, ldionne, libcxx-commits Differential Revision: https://reviews.llvm.org/D53063 llvm-svn: 344121
* [NFC][unwind] Improve error message when a type has more than one RTTIsLouis Dionne2018-10-091-2/+3
| | | | | | | | | | The "dynamic_cast error 2" error can apparently happen when the same type (with RTTI) is defined in more than one translation unit, and those translation units are linked together. This is technically an ODR violation, but making the error message more obvious is still helpful. llvm-svn: 344052
* Fix incorrectly aligned exceptions in 32 bit builds.Eric Fiselier2018-09-221-0/+3
| | | | | | | | | | | | | | | | | This patch fixes a bug where exceptions in 32 bit builds would be incorrectly aligned because malloc only provides 8 byte aligned memory where 16 byte alignment is needed. This patch makes libc++abi correctly use posix_memalign when it's available. This requires defining _LIBCPP_BUILDING_LIBRARY so that libc++ only defines _LIBCPP_HAS_NO_ALIGNED_ALLOCATION when libc doesn't support it and not when aligned new/delete are disable for other reasons. This bug somehow made it into the 7.0 release, making it a regression. Therefore this patch should be included in the next dot release. llvm-svn: 342815
* [libc++abi] is_strcmp parameter to is_equal is unused for WIN32Pirama Arumuga Nainar2018-09-211-0/+1
| | | | | | | | | | | | Summary: Mark it as unused to avoid -Wunused-parameter. Reviewers: EricWF, srhines, mstorsjo Subscribers: christof, ldionne, libcxx-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D52368 llvm-svn: 342764
* Merge Demangle change in r342330 to libcxxabi.Nico Weber2018-09-152-31/+15
| | | | | | Differential Revision: https://reviews.llvm.org/D52104 llvm-svn: 342331
* Port my recent changes from LLVM copy of the demangler:Richard Smith2018-08-241-24/+74
| | | | | | | | | | | r340663 - Allow Allocator::make to make a node of a different type than that requested. r340664 - Add documentation comment to ForwardTemplateReference. r340665 - Fix ExpandedSpecialSubstitution demangling for Sa and Sb. r340670 - Allow demangler's node allocator to fail, and bail out of the entire demangling process when it does. llvm-svn: 340671
* Port LLVM r340203 (and r340205) to libcxxabi.Richard Smith2018-08-202-4835/+5273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move Itanium demangler implementation into a header file and add visitation support. Summary: This transforms the Itanium demangler into a generic reusable library that can be used to build, traverse, and transform Itanium mangled name trees. This is in preparation for adding a canonicalizing demangler, which cannot live in the Demangle library for layering reasons. In order to keep the diffs simpler, this patch moves more code to the new header than is strictly necessary: in particular, all of the printLeft / printRight implementations can be moved to the implementation file. (And indeed we could make them non-virtual now if we wished, and remove the vptr from Node.) All nodes are now included in the Kind enumeration, rather than omitting some of the Expr nodes, and the three different floating-point literal node types now have distinct Kind values. As a proof of concept for the visitation / matching mechanism, this patch implements a Node dumping facility on top of it, replacing the prior mechanism that produced the pretty-printed output rather than a tree dump. Sample dump output: FunctionEncoding( NameType("int"), NameWithTemplateArgs( NestedName( NameWithTemplateArgs( NameType("A"), TemplateArgs( {NameType("B")})), NameType("f")), TemplateArgs( {NameType("int")})), {}, <null>, QualConst, FunctionRefQual::FrefQualLValue) As a next step, it would make sense to move the LLVM high-level interface to the demangler (the itaniumDemangler function and ItaniumPartialDemangler class) into the Support library, and implement them in terms of the Demangle library. This would allow the libc++abi demangler implementation to be an identical copy of the llvm Demangle library, and would allow the LLVM implementation to reuse LLVM components such as llvm::BumpPtrAllocator, but we'll need to decide how to coordinate that with the MS ABI demangler, so I'm not doing that in this patch. No functionality change intended other than the behavior of dump(). Reviewers: erik.pilkington, zturner, chandlerc, dlj Subscribers: aheejin, llvm-commits Differential Revision: https://reviews.llvm.org/D50930 llvm-svn: 340207
* Factor Node creation out of the demangler. No functionality change intended.Richard Smith2018-08-161-72/+94
| | | | | | (This is a port of llvm r339944 to libcxxabi.) llvm-svn: 339952
* [itanium demangler] Add llvm::itaniumFindTypesInMangledName()Erik Pilkington2018-08-131-0/+6
| | | | | | | | | | | | This function calls a callback whenever a <type> is parsed. This is necessary to implement FindAlternateFunctionManglings in LLDB, which uses a similar hack in FastDemangle. Once that function has been updated to use this version, FastDemangle can finally be removed. Differential revision: https://reviews.llvm.org/D50586 llvm-svn: 339580
* Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0Martin Storsjo2018-08-111-1/+1
| | | | | | This was missed in SVN r337754. llvm-svn: 339503
* [itanium demangler] Support dot suffixes on block invocation functionsErik Pilkington2018-08-021-0/+2
| | | | | | rdar://32378759 llvm-svn: 338747
* [libc++] Remove _LIBCPP_BUILDING_XXX macros, which are redundant since ↵Louis Dionne2018-08-012-2/+0
| | | | | | | | | | | | | | _LIBCPP_BUILDING_LIBRARY Summary: As suggested by Marshall in https://reviews.llvm.org/D49914 Reviewers: mclow.lists, EricWF Subscribers: christof, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50008 llvm-svn: 338475
* [demangler] Fix an oss-fuzz bug from r338138Erik Pilkington2018-07-281-0/+8
| | | | | | | | Stack overflow on invalid. While collapsing references, we were skipping over a cycle check in ForwardTemplateReference leading to a stack overflow. This commit fixes the problem by duplicating the cycle check in ReferenceType. llvm-svn: 338190
* [demangler] Support for reference collapsingErik Pilkington2018-07-271-45/+56
| | | | | | llvm.org/PR38323 llvm-svn: 338138
OpenPOWER on IntegriCloud