Let exceptions pass through aarch64 callVirtualFunction built with Clang

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 12 August 2020 19:11 UTC

At least with Clang 12 trunk on Linux, CustomTarget_testtools/uno_test aborted with

libc++abi: terminating with uncaught exception of type com::sun::star::uno::RuntimeException

at

> #0 0x0000ffffad97e598 in raise () from /lib64/libc.so.6 > #1 0x0000ffffad96ada0 in abort () from /lib64/libc.so.6 > #2 0x0000ffffadbf704c in abort_message (format=format@entry=0xffffadbfa398 "terminating with %s exception of type %s") at /llvm/llvm-project/libcxxabi/src/abort_message.cpp:78 > #3 0x0000ffffadbe50ec in demangling_terminate_handler () at /llvm/llvm-project/libcxxabi/src/cxa_default_handlers.cpp:67 > #4 0x0000ffffadbf633c in std::__terminate (func=) at /llvm/llvm-project/libcxxabi/src/cxa_handlers.cpp:59 > #5 0x0000ffffadbf92ac in __cxxabiv1::failed_throw (exception_header=0x361b5970) at /llvm/llvm-project/libcxxabi/src/cxa_exception.cpp:152 > #6 __cxxabiv1::__cxa_throw (thrown_object=0x361b59f0, tinfo=0x43f5a0 , dest=0xffffa0575b84 ) at /llvm/llvm-project/libcxxabi/src/cxa_exception.cpp:283 > #7 0x0000ffffa056944c in bridge_object::(anonymous namespace)::Test_Impl::getRaiseAttr1 (this=0x361810c0) at testtools/source/bridgetest/cppobj.cxx:296 > #8 0x0000ffffa0644b70 in callVirtualFunction (function=281473371790408, gpr=0xffffcc4c1b68, fpr=0xffffcc4c1b28, stack=0xffffcc4c18d0, sp=0, ret=0xffffcc4c1cf0) at bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx:38 > #9 0x0000ffffa064c5b4 in (anonymous namespace)::call (proxy=0x36193710, slot=..., returnType=0x3615b380, count=0, parameters=0x0, returnValue=0xffffcc4c1cf0, arguments=0xffffcc4c1cf0, exception=0xffffcc4c1e78) at bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx:176 > #10 0x0000ffffa064bd58 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch (pUnoI=0x36193710, pMemberDescr=0x361a5b70, pReturn=0xffffcc4c1cf0, pArgs=0xffffcc4c1cf0, ppException=0xffffcc4c1e78) at bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx:328 > #11 0x0000ffffa064b174 in (anonymous namespace)::call (proxy=0x361a9280, description=..., returnType=0x3615b380, count=0, parameters=0x0, gpr=0xffffcc4c2070, fpr=0xffffcc4c20b0, stack=0xffffcc4c20f0, indirectRet=0x361a92a8) at bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx:120 > #12 0x0000ffffa064a900 in vtableCall (functionIndex=37, vtableOffset=0, gpr=0xffffcc4c2070, fpr=0xffffcc4c20b0, stack=0xffffcc4c20f0, indirectRet=0x361a92a8) at bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx:240 > #13 0x0000ffffa065c1cc in vtableSlotCall () from instdir/program/libgcc3_uno.so > #14 0x0000ffffa05f9ce0 in bridge_test::performTest (xContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x3616eac0, xLBT=uno::Reference to (com::sun::star::uno::XInterface *) 0x361a92a8, noCurrentContext=false) at testtools/source/bridgetest/bridgetest.cxx:527 > #15 0x0000ffffa05f7400 in bridge_test::(anonymous namespace)::TestBridgeImpl::run (this=0x361806e0, rArgs=uno::Sequence of length 1 = {...}) at testtools/source/bridgetest/bridgetest.cxx:1168 > #16 0x00000000004050c0 in sal_main () at cpputools/source/unoexe/unoexe.cxx:517 > #17 0x00000000004040cc in main (argc=8, argv=0xffffcc4c4458) at cpputools/source/unoexe/unoexe.cxx:357

The reason is that _Unwind_RaiseException (in libgcc_s.so.1) called from __cxa_throw (in libc++abi.so.1) for some reason does not find unwind information for the callVirtualFunction frame #8, so returns _URC_FATAL_PHASE2_ERROR. This looks similar to the issue discussed in the comment at the top of bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx introduced with 0fdbb5b0eabbaa571f3747fda12a56c938cba474 "Make cpp_uno/gcc3_linux_x86-64 bridge work with GCC 4.7". Though what happens to fix it here appears to be-fasynchronous-unwind-tables. (The -fnon-call-exceptions mentioned in that comment appears to be ignored by Clang.)

The actual difference that -fasynchronous-unwind-tables makes in the generated callvirtualfunction.s is that it drops a single line

> .Lfunc_begin0: > .file 7 "" "bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx" > .loc 7 32 0 // bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx:32:0 > - .cfi_sections .debug_frame > .cfi_startproc > // %bb.0: > stp d15, d14, [sp, #-128]! // 16-byte Folded Spill

Change-Id: Ib60e9f4958c6041b10ca959a0953e998ac6f141a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100614

2cb40c77cd05 Let exceptions pass through aarch64 callVirtualFunction built with Clang
bridges/Library_cpp_uno.mk | 1 +
1 file changed, 1 insertion(+)

Upstream: cgit.freedesktop.org


  • Share