aboutsummaryrefslogtreecommitdiff
path: root/libcxxabi
AgeCommit message (Collapse)AuthorFilesLines
2022-11-10[CMake] Fix -Wstrict-prototypesSam James1-1/+1
Fixes warnings (or errors, if someone injects -Werror in their build system, which happens in fact with some folks vendoring LLVM too) with Clang 16: ``` +/var/tmp/portage.notmp/portage/sys-devel/llvm-15.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] -/var/tmp/portage.notmp/portage/sys-devel/llvm-14.0.4/work/llvm_build-abi_x86_64.amd64/CMakeFiles/CMakeTmp/src.c:3:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] int main() {return 0;} ^ void ``` Differential Revision: https://reviews.llvm.org/D137503 (cherry picked from commit 32a2af44e1e882f13d1cc2817f0a8d4d8b375d4d)
2022-07-22Remove references to old mailing lists that have moved to discourse. Replace ↵tlattner1-1/+1
with links to discourse. Reviewed By: #libc_abi, ldionne Differential Revision: https://reviews.llvm.org/D129675
2022-07-14[libcxxabi][CMake] Set --unwindlib=none when using LLVM libunwindPetr Hosek1-0/+7
We already link libunwind explicitly so avoid trying to link toolchain's default libunwind which may be missing. This matches what we already do for libcxx. Differential Revision: https://reviews.llvm.org/D129469
2022-06-28[SystemZ][z/OS] Modify cxxabi to be compatible with existing z/OS runtimeMuiez Ahmed2-2/+12
This patch is to enable exception handling on the z/OS platform that is compatible with the existing z/OS runtime. No functionality of libcxxabi has been changed for other platforms. With this patch the hope is we can add z/OS as a platform to perform testing on any C++ ABI changes. There is a primary difference for the z/OS implementation. On z/OS the thrown object is added to a linked list of caught and uncaught exceptions. The unwinder uses the top one as the current exception it is trying to find the landing pad for. We have to pop the top exception after we get it’s landing pad for our unwinder to correctly get any subsequent rethrows or nested exception calls. Differential Revision: https://reviews.llvm.org/D99913
2022-06-21[libc++abi][AIX] Use _LIBCXXABI_FUNC_VIS for exported routinesXing Xue1-10/+13
Summary: This patch adds _LIBCXXABI_FUNC_VIS to the definitions of the personality and helper routines for the state table based EH, now that the support of the visibility attribute is being added to AIX Clang. Currently an export list is generated in the absence of the visibility attribute support downstream. Reviewed by: MaskRay, daltenty Differential Revision: https://reviews.llvm.org/D126915
2022-06-21[libc++][CI] Updates GCC to version 12.Mark de Wever1-1/+1
Reviewed By: ldionne, philnik, #libc, #libc_abi Differential Revision: https://reviews.llvm.org/D126667
2022-06-15[libcxx] Remove extraneous '---' lines in .clang-format filesowenca1-2/+0
2022-06-13[libcxx][AIX] Switch build compiler to clangJake Egan2-1/+6
This patch switches the build compiler for AIX from ibm-clang to clang. ibm-clang++_r has `-pthread` by default, but clang for AIX doesn't, so `-pthread` had to be added to the test config. A bunch of tests now pass, so the `XFAIL` was removed. This patch also switch the build to use the visibility support available in clang-15 to control symbols exported by the shared library (AIX traditionally uses explicit export lists for this purpose). Reviewed By: #libc, #libc_abi, daltenty, #libunwind, ldionne Differential Revision: https://reviews.llvm.org/D127470
2022-06-08[libc++] Towards a simpler extern template story in libc++Louis Dionne1-3/+0
The flexibility around extern template instantiation declarations in libc++ result in a very complicated model, especially when support for slightly different configurations (like the debug mode or assertions in the dylib) are taken into account. That results in unexpected bugs like http://llvm.org/PR50534 (and there have been multiple similar bugs in the past, notably around the debug mode). This patch gets rid of the _LIBCPP_DISABLE_EXTERN_TEMPLATE knob, which I don't think is fundamental. Indeed, the motivation for that knob was to avoid taking a dependency on the library, however that can be done better by linking against the static library instead. And in fact, some parts of the headers will always depend on things defined in the library, which defeats the original goal of _LIBCPP_DISABLE_EXTERN_TEMPLATE. Differential Revision: https://reviews.llvm.org/D103960
2022-06-06[libcxxabi] Check __SEH__, when checking if ARM EHABI is impliedMartin Storsjö1-1/+1
ARM EHABI isn't signalled by any specific compiler builtin define, but is implied by the lack of defines specifying any other exception handling mechanism, `__USING_SJLJ_EXCEPTIONS__` or `__ARM_DWARF_EH__`. As Windows SEH also can be used for unwinding, check for the `__SEH__` define too, in the same way. Differential Revision: https://reviews.llvm.org/D126866
2022-05-31[libc++abi][AIX] add personality and helper functions for the state table EHXing Xue2-0/+687
Summary: This patch adds the personality and helper functions for the state table based EH used by IBM legacy compilers xlC and xlclang++ on AIX. * A high level description of the state table based EH is provided in the code comments. * Function scan_state_tab() is added to scan the state table. It is invoked by the state table personality routine __xlcxx_personality_v0() and returns scan_results like scan_eh_tab() does. * A couple of EH helper functions used by xlC and xlclang++ generated code are also added, e.g., __xlc_catch_matchv2() which checks whether the thrown object matches the catch handler's exception type. * Debugging macros _LIBCXXABI_TRACE_STATETAB, _LIBCXXABI_TRACE_STATETAB0, and _LIBCXXABI_TRACING_STATETAB are added to dump state table scanning traces if environment variable LIBCXXABI_PRINT_STATTAB is set. * The state variable and state table data is the LSDA found from the traceback table of the function during unwinding. Reviewed by: MaskRay, cebowleratibm, libc++abi Differential Revision: https://reviews.llvm.org/D100504
2022-05-27[runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZLouis Dionne6-6/+6
Since those features are general properties of the environment, it makes sense to use them from libc++abi too, and so the name libcpp-has-no-xxx doesn't make sense. Differential Revision: https://reviews.llvm.org/D126482
2022-05-27[runtimes] Officially deprecate the legacy testing configuration systemLouis Dionne1-0/+3
Add a warning and tweak the release note to explain that the deprecation targets libc++, libc++abi and libuwnind as well. Also, as a fly-by, ensure that our CI runs the legacy testing configuration for libc++, libc++abi and libunwind. This doesn't matter too much since it's deprecated, but we might as well test it properly. Differential Revision: https://reviews.llvm.org/D126478
2022-05-27[demangler][RISCV] Fix for long doublePiggy NL1-1/+1
Summary: The size of long double in RISCV (both RV32 and RV64) is 16 bytes, thus the mangled_size shouble be 32. This patch will fix test case "_ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c" in test_demangle.pass.cpp, which is expected to be invalid but demangler returned "void test0::h<float>(char (&) [(unsigned int)((sizeof (float)) + (0x0.000000004001ap-16382L))])" in RISCV environment without this patch. Reviewed By: urnathan Differential Revision: https://reviews.llvm.org/D126480
2022-05-26[libc++abi] Use from-scratch testing configs for libc++abi by defaultLouis Dionne21-29/+223
Like we have been doing for libc++ for a while now, start using from-scratch testing configurations for libc++abi. As a fly-by fix, remove the LIBCXXABI_NO_TIMER macro, which was defined but never used. Differential Revision: https://reviews.llvm.org/D125242
2022-05-20[libc++abi] Add missing XFAIL on testLouis Dionne1-0/+1
2022-05-19[runtimes] Fix the build of merged ABI/unwinder librariesLouis Dionne3-2/+31
Also, add a CI job that tests this configuration. The exact configuration is that we build a shared libc++ and merge objects for the ABI library and the unwinder library into it. Differential Revision: https://reviews.llvm.org/D125903
2022-05-18[runtimes] Default LIB*_HERMETIC_STATIC_LIBRARY to ON on WindowsMartin Storsjö2-21/+9
(In the case of libunwind, the cmake option is called LIBUNWIND_HIDE_SYMBOLS, but it has the same effect as LIBCXX_HERMETIC_STATIC_LIBRARY and LIBCXXABI_HERMETIC_STATIC_LIBRARY.) Previously, the same issue was dealt with by setting a project wide define (_LIBUNWIND_HIDE_SYMBOLS, _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS and _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) if only building a static library. If building both static and shared at the same time, this wasn't set, and the static library would contain dllexport directives. The LIB*_HERMETIC_STATIC_LIBRARY and LIBUNWIND_HIDE_SYMBOLS cmake options only apply the defines to the static library in the build, even if building both static and shared at the same time. (This could only be done use after the object libraries were enabled, as a shared libcxx needs libcxxabi object files built with dllexports included.) This allows removing inelegant code for deciding how to build the libcxxabi static library and a TODO comment that suggested that users should need to start setting an option, which they shouldn't need to. Finally, this gets rid of two XFAILs in tests. Differential Revision: https://reviews.llvm.org/D125715
2022-05-18[libunwind][AArch64] Add support for DWARF expression for RA_SIGN_STATE.Daniel Kiss1-0/+63
Program may set the RA_SIGN_STATE pseudo register by expressions. Libunwind expected only the DW_CFA_AARCH64_negate_ra_state could change the value of the register which leads to runtime errors on PAC enabled systems. In the recent version of the aadwarf64[1] a limitation is added[2] to forbid the mixing the DW_CFA_AARCH64_negate_ra_state with other DWARF Register Rule Instructions. [1] https://github.com/ARM-software/abi-aa/releases/tag/2022Q1 [2] https://github.com/ARM-software/abi-aa/pull/129 Reviewed By: #libunwind, MaskRay Differential Revision: https://reviews.llvm.org/D123692 Reland: test moved because it depends on exceptions.
2022-05-16[runtimes] Introduce object librariesLouis Dionne2-81/+82
This is a variant of D116689 rebased on top of the new (proposed) ABI refactoring in D120727. It should conserve the basic properties of the original patch by @phosek, except it also allows cleaning up the merging of libc++abi into libc++ from the libc++ side. Differential Revision: https://reviews.llvm.org/D125393
2022-05-14[libcxxabi] Copy headers into build locationPetr Hosek2-1/+21
Prior to D120727, the libcxx build was responsible for copying libcxxabi headers into the right location, both in the build and install trees, but now it's the responsibility of the libcxxabi build. While the build already did the right thing for the install tree, it wouldn't copy headers into the build tree, resulting in errors when trying to use the just built toolchain as is the case in the runtimes build when building compiler-rt runtimes. Differential Revision: https://reviews.llvm.org/D125597
2022-05-13[runtimes][NFC] Remove dead code for Standalone buildsLouis Dionne2-72/+9
Standalone builds have been deprecated and then removed for a while now. Trying to use standalone builds leads to a fatal CMake error, so this code is all dead. Remove it to clean things up. Differential Revision: https://reviews.llvm.org/D125561
2022-05-13[libc++abi][NFCI] Refactor demangling_terminate_handler to reduce nestingLouis Dionne1-40/+41
This keeps the same logic, but uses early return to avoid multiple layers of nested ifs and make the code simpler to follow. Differential Revision: https://reviews.llvm.org/D125476
2022-05-13[libc++] Overhaul how we select the ABI libraryLouis Dionne4-5/+6
This patch overhauls how we pick up the ABI library. Instead of setting ad-hoc flags, it creates interface targets that can be linked against by the rest of the build, which is easier to follow and extend to support new ABI libraries. This is intended to be a NFC change, however there are some additional simplifications and improvements we can make in the future that would require a slight behavior change. Differential Revision: https://reviews.llvm.org/D120727
2022-05-13[demangler] Avoid special-subst code duplicationNathan Sidwell1-73/+37
We need to expand special substitutions in four different ways. This refactors to only have one conversion from enum to string, and derive the other 3 needs off that. The SpecialSubstitution node is derived from the ExpandedSpecialSubstitution. While this may seem unintuitive, it works out quite well, as SpecialSubstitution can then use the former's getBaseName and remove an unneeded 'basic_' prefix, for those substitutions that are instantiations (to known typedef). Similarly all those instantiations use the same set of template arguments (with 'basic_string', getting an additional 'allocator' arg). Expansion tests were added in D123134, and remain unchanged. Reviewed By: MaskRay, dblaikie Differential Revision: https://reviews.llvm.org/D125257
2022-05-12[libc++abi][NFC] Add comment on long reaching #ifLouis Dionne1-2/+2
2022-05-12[libc++abi] Refactor exception type demangling into a separate functionLouis Dionne1-13/+16
As a fly-by fix, also let `__cxa_demangle` allocate its buffer alone, since we are not allowed to pass a non-malloc'd buffer to it. Differential Revision: https://reviews.llvm.org/D125268
2022-05-11[runtimes] Print the testing configuration in use in libunwind and libc++abiLouis Dionne1-0/+1
We do it for libc++, and it's rather useful for debugging e.g. CI.
2022-05-10[libc++abi][NFC] Fix typo in commentLouis Dionne1-3/+3
2022-05-10[libc++abi] Reword uncaught exception termination messageLouis Dionne1-5/+5
When we terminate due to an exception being uncaught, libc++abi prints a message saying "terminating with uncaught exception [...]". This patch changes that to say "terminating due to uncaught exception [...]" instead, which is a bit clearer. Indeed, I've seen some people being confused and thinking that libc++abi was the component throwing the exception. Differential Revision: https://reviews.llvm.org/D125245
2022-05-10[libcxxabi] [cmake] Fix a mismatched variable nameMartin Storsjö1-1/+1
The variable name checked didn't match the one set on the line above. This error was introduced in b3df14b6c98702ce50401fd039852787373e4676.
2022-05-09[demangler] No need to space adjacent template closingsNathan Sidwell2-3582/+3602
With the demangler parenthesizing 'a >> b' inside template parameters, because C++11 parsing of >> there, we don't really need to add spaces between adjacent template arg closing '>' chars. In 2022, that just looks odd. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D123134
2022-05-09[demangler] Buffer peeking needs bufferNathan Sidwell1-1/+2
The output buffer has a 'back' member, which returns NUL when you try it with an empty buffer. But there are no use cases that need that additional functionality. This makes the 'back' member behave more like STL containers' back members. (It still returns a value, not a reference.) Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123201
2022-05-05[libcxxabi] Use the right calling convention for exception destructors on ↵Martin Storsjö4-4/+10
i386 Windows On Windows on i386, C++ member functions use a different calling convention (`__thiscall`) than the default one for regular functions (`__cdecl`). (On Windows on architectures other than i386, both calling convention attributes are no-ops.) This matches how libstdc++ declares these types. This fixes the std/thread/futures/futures.{shared,unique}_future/dtor.pass.cpp tests on i386 mingw. Differential Revision: https://reviews.llvm.org/D124990
2022-05-03[demangler] Fold expressions of .* and ->*Nathan Sidwell2-1/+10
(Exitingly) a fold expression's operators include .* and ->*, but we failed to demangle them as we categorize those as MemberExprs, not BinaryExprs. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123305
2022-04-29Disable test for Android/Bionic.Daniel Kiss1-0/+8
Test depends on pthread_cancel which is not supported on Android.
2022-04-28[libunwind][AArch64] Fix _Unwind_ForcedUnwind via sigreturn.Daniel Kiss1-0/+50
When the sigreturn trampoline is found the unw_proc_info_t.end_ip need to be set to indicate a stack frame is found. Reviewed By: cjdb, #libunwind, MaskRay Differential Revision: https://reviews.llvm.org/D124522
2022-04-28[demangler] Fix demangling a template argument which happens to be a null ↵gbreynoo2-1/+2
pointer As seen in https://github.com/llvm/llvm-project/issues/51854 llvm-cxxfilt was having trouble demangling the case "_Z1fIDnLDn0EEvv". We handled the "LDNE" case and "LPi0E" but not "LDn0E". This change adds that handling. Differential Revision: https://reviews.llvm.org/D124010
2022-04-26Revert "[demangler] Simplify OutputBuffer initialization"Kirill Stoimenov2-4/+26
Reverting due to a bot failure: https://lab.llvm.org/buildbot/#/builders/5/builds/22738 This reverts commit 5b3ca24a35e91bf9c19af856e7f92c69b17f989e.
2022-04-26[demangler] Simplify OutputBuffer initializationNathan Sidwell2-26/+4
Every non-testcase use of OutputBuffer contains code to allocate an initial buffer (using either 128 or 1024 as initial guesses). There's now no need to do that, given recent changes to the buffer extension heuristics -- it allocates a 1k(ish) buffer on first need. Just pass in a buffer (if any) to the constructor. Thus the OutputBuffer's ownership of the buffer starts at its own lifetime start. We can reduce the lifetime of this object in several cases. That new constructor takes a 'size_t *' for the size argument, as all uses with a non-null buffer are passing through a malloc'd buffer from their own caller in this manner. The buffer reset member function is never used, and is deleted. The original buffer initialization code would return a failure code if that first malloc failed. Existing code either ignored that, called std::terminate with a FIXME, or returned an error code. But that's not foolproof anyway, as a subsequent buffer extension failure ends up calling std::terminate. I am working on addressing that unfortunate failure mode in a manner more consistent with the C++ ABI design. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D122604
2022-04-25[demangler][NFC] OperatorInfo table unit testNathan Sidwell1-100/+88
Placing a run-once test inside the operator lookup function caused problems with the thread sanitizer. See D122975. Break out the operator table into a member variable, and move the test to the unit test machinery. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D123390
2022-04-24[runtimes] [CMake] Unify variable namesPetr Hosek4-23/+23
Avoid repeating CMake checks across runtimes by unifying names of variables used for results to leverage CMake caching. Differential Revision: https://reviews.llvm.org/D110005
2022-04-08[demangler] Support C23 _BitInt typeSenran Zhang3-0/+41
Reviewed By: #libc_abi, aaron.ballman, urnathan Differential Revision: https://reviews.llvm.org/D122530
2022-04-07[libc++] Add back-deployment testing on arm64 macsLouis Dionne2-0/+2
Differential Revision: https://reviews.llvm.org/D123081
2022-04-06[libc++abi] Remove XFAIL on arm64Louis Dionne1-3/+0
The underlying TLS destruction order bug has been fixed in the OS. This would technically still fail when running on top of macOS < 12, however we don't have a good way of encoding that using Lit features. Indeed, the existing target=<FOO> Lit feature encodes the deployment target, not the actual runtime system that the tests are being run on. If this test starts failing on your machine after this patch, upgrading to macOS 12 should solve the problem.
2022-04-06[demangler] Node precision dumperNathan Sidwell1-2/+43
Add contents to the demangler node dumper's print(Prec) functions. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D122740
2022-04-06[demangler][NFC] Rename SwapAndRestore to ScopedOverrideNathan Sidwell2-31/+30
The demangler has a utility class 'SwapAndRestore'. That name is confusing. It's not swapping anything, and the restore part happens at the object's destruction. What it's actually doing is allowing a override of some value that is dynamically accessible within the lifetime of a lexical scope. Thus rename it to ScopedOverride, and tweak it's member variable names. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D122606
2022-04-06[demangler] Fix undocumented Local encodingNathan Sidwell2-16/+21
GCC emits [some] static symbols with an 'L' mangling, which we attempt to demangle. But the module mangling changes have exposed that we were doing so at the wrong level. Such manglings are outside of the ABI as they are internal-linkage, so a bit of reverse engineering was needed. This adjusts the demangler along the same lines as the existing gcc demangler (which is not yet module-aware). 'L' is part of an unqualified name. As before we merely parse the 'L', and then ignore it. Reviewed By: iains Differential Revision: https://reviews.llvm.org/D123138
2022-04-04[demangler] Parenthesize >> inside template argsNathan Sidwell2-2/+3
Both > and >> expressions need to be parenthesized inside template argument lists. Reviewed By: dblaikie, rjmccall Differential Revision: https://reviews.llvm.org/D122474
2022-04-01[demangler] Fix node matchersNathan Sidwell1-5/+5
* Add instantiation tests to ItaniumDemangleTest, to make sure all match functions provide constructor arguments to the provided functor. * Fix the Node constructors that lost const qualification on arguments. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D122665