git: 8715a89426cc - main - editors/libreoffice: fix build on powerpc

Piotr Kubaj pkubaj at FreeBSD.org
Tue Jun 15 08:42:19 UTC 2021


The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8715a89426cc87dd330f6d7783975a90b98b4821

commit 8715a89426cc87dd330f6d7783975a90b98b4821
Author:     Piotr Kubaj <pkubaj at FreeBSD.org>
AuthorDate: 2021-06-15 08:41:12 +0000
Commit:     Piotr Kubaj <pkubaj at FreeBSD.org>
CommitDate: 2021-06-15 08:41:12 +0000

    editors/libreoffice: fix build on powerpc
    
    Use the same patches as for powerpc64.
---
 ...es-source-cpp_uno-gcc3_linux_powerpc-except.cxx | 112 +++++++++++++++++++++
 ...ges-source-cpp_uno-gcc3_linux_powerpc-share.hxx | 106 +++++++++++++++++++
 2 files changed, 218 insertions(+)

diff --git a/editors/libreoffice6/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-except.cxx b/editors/libreoffice6/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-except.cxx
new file mode 100644
index 000000000000..dbc6e134f1e1
--- /dev/null
+++ b/editors/libreoffice6/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-except.cxx
@@ -0,0 +1,112 @@
+--- bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx.orig	2019-12-05 13:59:23.000000000 -0600
++++ bridges/source/cpp_uno/gcc3_linux_powerpc/except.cxx	2020-09-14 11:24:58.489149000 -0500
+@@ -24,6 +24,7 @@
+ #include <cxxabi.h>
+ #include <rtl/strbuf.hxx>
+ #include <rtl/ustrbuf.hxx>
++#include <sal/log.hxx>
+ #include <osl/mutex.hxx>
+ 
+ #include <com/sun/star/uno/genfunc.hxx>
+@@ -136,7 +137,7 @@
+         buf.append( 'E' );
+ 
+         OString symName( buf.makeStringAndClear() );
+-        rtti = (type_info *)dlsym( m_hApp, symName.getStr() );
++        rtti = static_cast<type_info *>(dlsym( m_hApp, symName.getStr() ));
+ 
+         if (rtti)
+         {
+@@ -161,9 +162,9 @@
+                 {
+                     // ensure availability of base
+                     type_info * base_rtti = getRTTI(
+-                        (typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription );
++                        pTypeDescr->pBaseTypeDescription );
+                     rtti = new __si_class_type_info(
+-                        strdup( rttiName ), (__class_type_info *)base_rtti );
++                        strdup( rttiName ), static_cast<__class_type_info *>(base_rtti ));
+                 }
+                 else
+                 {
+@@ -192,8 +193,8 @@
+ 
+ static void deleteException( void * pExc )
+ {
+-    __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
+-    typelib_TypeDescription * pTD = 0;
++    __cxxabiv1::__cxa_exception const * header = static_cast<__cxxabiv1::__cxa_exception const *>(pExc) - 1;
++    typelib_TypeDescription * pTD = nullptr;
+     OUString unoName( toUNOname( header->exceptionType->name() ) );
+     ::typelib_typedescription_getByName( &pTD, unoName.pData );
+     assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
+@@ -216,39 +217,57 @@
+     if (! pTypeDescr)
+         terminate();
+ 
+-    pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
++    pCppExc = __cxxabiv1::__cxa_allocate_exception( pTypeDescr->nSize );
+     ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
+ 
+     // destruct uno exception
+-    ::uno_any_destruct( pUnoExc, 0 );
++    ::uno_any_destruct( pUnoExc, nullptr );
+     // avoiding locked counts
+     static RTTI rtti_data;
+-    rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
++    rtti = rtti_data.getRTTI(reinterpret_cast<typelib_CompoundTypeDescription*>(pTypeDescr));
+     TYPELIB_DANGER_RELEASE( pTypeDescr );
+     if (! rtti)
+-        terminate();
++    {
++        throw RuntimeException(
++            "no rtti for type " +
++            OUString::unacquired( &pUnoExc->pType->pTypeName ) );
+     }
++    }
+ 
+-    __cxa_throw( pCppExc, rtti, deleteException );
++    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
+ }
+ 
+ void fillUnoException(uno_Any * pExc, uno_Mapping * pCpp2Uno)
+ {
+-    __cxa_exception * header = __cxa_get_globals()->caughtExceptions;
++    __cxxabiv1::__cxa_exception * header = 
++                 __cxxabiv1::__cxa_get_globals()->caughtExceptions;
+     if (! header)
+         terminate();
+ 
+-    std::type_info *exceptionType = __cxa_current_exception_type();
++    std::type_info *exceptionType = __cxxabiv1::__cxa_current_exception_type();
+ 
+-    typelib_TypeDescription * pExcTypeDescr = 0;
++    typelib_TypeDescription * pExcTypeDescr = nullptr;
+     OUString unoName( toUNOname( exceptionType->name() ) );
+-    ::typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
+-    if (! pExcTypeDescr)
++    typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
++    if (pExcTypeDescr == nullptr)
++    {
++        RuntimeException aRE( "exception type not found: " + unoName );
++        Type const & rType = cppu::UnoType<decltype(aRE)>::get();
++        uno_type_any_constructAndConvert( pExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
++        SAL_WARN("bridges", aRE.Message);
++    }
++    else
++    {
++        // construct uno exception any
++        uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
++        typelib_typedescription_release( pExcTypeDescr );
++    }
++    if (nullptr == pExcTypeDescr)
+         terminate();
+ 
+     // construct uno exception any
+-    ::uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
+-    ::typelib_typedescription_release( pExcTypeDescr );
++    uno_any_constructAndConvert( pExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
++    typelib_typedescription_release( pExcTypeDescr );
+ }
+ 
+ }
diff --git a/editors/libreoffice6/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-share.hxx b/editors/libreoffice6/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-share.hxx
new file mode 100644
index 000000000000..0d2481e9fbb6
--- /dev/null
+++ b/editors/libreoffice6/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc-share.hxx
@@ -0,0 +1,106 @@
+--- bridges/source/cpp_uno/gcc3_linux_powerpc/share.hxx.orig	2020-04-07 10:06:14.193381000 -0500
++++ bridges/source/cpp_uno/gcc3_linux_powerpc/share.hxx	2020-04-09 11:33:30.706043000 -0500
+@@ -25,6 +25,63 @@
+ #include <exception>
+ #include <cstddef>
+ 
++#include <cxxabi.h>
++#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
++#define _GLIBCXX_CDTOR_CALLABI
++#endif
++#include <unwind.h>
++
++#include <config_cxxabi.h>
++
++#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
++// <https://mentorembedded.github.io/cxx-abi/abi.html>,
++// libstdc++-v3/libsupc++/cxxabi.h:
++namespace __cxxabiv1 {
++class __class_type_info: public std::type_info {
++public:
++    explicit __class_type_info(char const * n): type_info(n) {}
++    ~__class_type_info() override;
++};
++}
++#endif
++
++#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
++// <https://mentorembedded.github.io/cxx-abi/abi.html>,
++// libstdc++-v3/libsupc++/cxxabi.h:
++namespace __cxxabiv1 {
++class __si_class_type_info: public __class_type_info {
++public:
++    __class_type_info const * __base_type;
++    explicit __si_class_type_info(
++        char const * n, __class_type_info const *base):
++        __class_type_info(n), __base_type(base) {}
++    ~__si_class_type_info() override;
++};
++}
++#endif
++#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
++namespace __cxxabiv1 { extern "C" void *__cxa_get_globals () throw(); }
++#endif
++#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
++namespace __cxxabiv1 {
++extern "C" std::type_info *__cxa_current_exception_type() throw();
++}
++#endif
++
++#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
++namespace __cxxabiv1 {
++extern "C" void *__cxa_allocate_exception(
++    std::size_t thrown_size ) throw();
++}
++#endif
++
++#if !HAVE_CXXABI_H_CXA_THROW
++namespace __cxxabiv1 {
++extern "C" void __cxa_throw (
++    void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
++}
++#endif
++
+ namespace CPPU_CURRENT_NAMESPACE
+ {
+ 
+@@ -33,6 +90,7 @@
+ 
+ // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+ 
++#if 0
+ struct _Unwind_Exception
+ {
+     unsigned exception_class __attribute__((__mode__(__DI__)));
+@@ -40,9 +98,11 @@
+     unsigned private_1 __attribute__((__mode__(__word__)));
+     unsigned private_2 __attribute__((__mode__(__word__)));
+ } __attribute__((__aligned__));
++#endif
+ 
+ struct __cxa_exception
+ {
++    //uintptr_t   referenceCount;
+     std::type_info *exceptionType;
+     void (*exceptionDestructor)(void *);
+ 
+@@ -62,19 +122,11 @@
+     _Unwind_Exception unwindHeader;
+ };
+ 
+-extern "C" void *__cxa_allocate_exception(
+-    std::size_t thrown_size ) throw();
+-extern "C" void __cxa_throw (
+-    void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
+-
+ struct __cxa_eh_globals
+ {
+     __cxa_exception *caughtExceptions;
+     unsigned int uncaughtExceptions;
+ };
+-
+-extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
+-extern "C" std::type_info *__cxa_current_exception_type() throw();
+ 
+ void raiseException(
+     uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );


More information about the dev-commits-ports-main mailing list