aboutsummaryrefslogtreecommitdiff
path: root/editors/libreoffice
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2021-01-20 17:26:37 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2021-01-20 17:26:37 +0000
commita5ac5ac896f2fa792f3b12505c7af3eb8d1ae319 (patch)
treecf0d32461a2682a36fcdc2c22923960d9bcad82c /editors/libreoffice
parent74e55da319b00e9dc38d622070fd9c35ab1515c6 (diff)
downloadports-a5ac5ac896f2fa792f3b12505c7af3eb8d1ae319.tar.gz
ports-a5ac5ac896f2fa792f3b12505c7af3eb8d1ae319.zip
editors/libreoffice: fix build on powerpc64 elfv2
This set of patches is applied only on powerpc* architectures. Submitted by: afsilva Approved by: tier 2 blanket
Notes
Notes: svn path=/head/; revision=562151
Diffstat (limited to 'editors/libreoffice')
-rw-r--r--editors/libreoffice/Makefile4
-rw-r--r--editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-cpp2uno.cxx79
-rw-r--r--editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-except.cxx112
-rw-r--r--editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-share.hxx106
-rw-r--r--editors/libreoffice/files/powerpc64/patch-cppuhelper_source_exc__thrower.cxx10
-rw-r--r--editors/libreoffice/files/powerpc64/patch-desktop_source_deployment_misc_dp__ucb.cxx20
-rw-r--r--editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.h11
-rw-r--r--editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.hxx20
-rw-r--r--editors/libreoffice/files/powerpc64/patch-include_uno_mapping.hxx10
-rw-r--r--editors/libreoffice/files/powerpc64/patch-ucb_source_ucp_file_bc.cxx10
10 files changed, 382 insertions, 0 deletions
diff --git a/editors/libreoffice/Makefile b/editors/libreoffice/Makefile
index e9ba03f367e9..508d41aea12b 100644
--- a/editors/libreoffice/Makefile
+++ b/editors/libreoffice/Makefile
@@ -282,6 +282,10 @@ MAKE_ENV+= verbose=1
.include <bsd.port.pre.mk>
+.if ${ARCH:Mpowerpc*}
+EXTRA_PATCHES+= ${FILESDIR}/powerpc64
+.endif
+
.if ${ARCH} == powerpc || ${ARCH} == powerpcspe || ${ARCH} == powerpc64
CONFIGURE_ARGS+= --disable-skia
.endif
diff --git a/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-cpp2uno.cxx b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-cpp2uno.cxx
new file mode 100644
index 000000000000..22102d34d855
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-cpp2uno.cxx
@@ -0,0 +1,79 @@
+--- bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx.orig 2020-04-04 12:03:03.236554000 -0500
++++ bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx 2020-04-08 14:28:30.208034000 -0500
+@@ -341,7 +341,7 @@
+
+ static typelib_TypeClass cpp_mediate(
+ sal_uInt64 nOffsetAndIndex,
+- void ** gpreg, void ** fpreg, long sp,
++ void ** gpreg, void ** fpreg, long fp,
+ sal_Int64 * pRegisterReturn /* space for register return */ )
+ {
+ static_assert(sizeof(sal_Int64)==sizeof(void *), "### unexpected!");
+@@ -349,8 +349,8 @@
+ sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
+ sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
+
+- long sf = *(long*)sp;
+- void ** ovrflw = (void**)(sf + PARAMSAVE + 64);
++ /* XXX: This is the stack frame!!!! */
++ void ** ovrflw = (void**)(fp + PARAMSAVE + 64);
+
+ // gpreg: [ret *], this, [other gpr params]
+ // fpreg: [fpr params]
+@@ -513,18 +513,22 @@
+ return eRet;
+ }
+
+-extern "C" void privateSnippetExecutor( ... )
++extern "C" void privateSnippetExecutor( uint64_t a, ... )
+ {
++ va_list args, fpargs;
+ sal_uInt64 gpreg[ppc64::MAX_GPR_REGS];
+
+- register long r3 asm("r3"); gpreg[0] = r3;
+- register long r4 asm("r4"); gpreg[1] = r4;
+- register long r5 asm("r5"); gpreg[2] = r5;
+- register long r6 asm("r6"); gpreg[3] = r6;
+- register long r7 asm("r7"); gpreg[4] = r7;
+- register long r8 asm("r8"); gpreg[5] = r8;
+- register long r9 asm("r9"); gpreg[6] = r9;
+- register long r10 asm("r10"); gpreg[7] = r10;
++ va_start(args, a);
++ va_copy(fpargs, args);
++ /* Start with all the GPRs */
++ gpreg[0] = a;
++ gpreg[1] = va_arg(args, uint64_t);
++ gpreg[2] = va_arg(args, uint64_t);
++ gpreg[3] = va_arg(args, uint64_t);
++ gpreg[4] = va_arg(args, uint64_t);
++ gpreg[5] = va_arg(args, uint64_t);
++ gpreg[6] = va_arg(args, uint64_t);
++ gpreg[7] = va_arg(args, uint64_t);
+
+ double fpreg[ppc64::MAX_SSE_REGS];
+
+@@ -547,11 +551,11 @@
+ "fr10", "fr11", "fr12", "fr13"
+ );
+
+- register long r11 asm("r11");
+- const long nOffsetAndIndex = r11;
++ long nOffsetAndIndex;
++ long fp;
+
+- register long r1 asm("r1");
+- const long sp = r1;
++ __asm __volatile("mr %0, 11\n" : "=r"(nOffsetAndIndex));
++ fp = (long)__builtin_frame_address(0);
+
+ #if defined(_CALL_ELF) && _CALL_ELF == 2
+ volatile long nRegReturn[2];
+@@ -560,7 +564,7 @@
+ #endif
+
+ typelib_TypeClass aType =
+- cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, sp, (sal_Int64*)nRegReturn);
++ cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, fp, (sal_Int64*)nRegReturn);
+
+ switch( aType )
+ {
diff --git a/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-except.cxx b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-except.cxx
new file mode 100644
index 000000000000..3d9108a73ece
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-except.cxx
@@ -0,0 +1,112 @@
+--- bridges/source/cpp_uno/gcc3_linux_powerpc64/except.cxx.orig 2019-12-05 13:59:23.000000000 -0600
++++ bridges/source/cpp_uno/gcc3_linux_powerpc64/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/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-share.hxx b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-share.hxx
new file mode 100644
index 000000000000..7411e8e8cf32
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-bridges-source-cpp_uno-gcc3_linux_powerpc64-share.hxx
@@ -0,0 +1,106 @@
+--- bridges/source/cpp_uno/gcc3_linux_powerpc64/share.hxx.orig 2020-04-07 10:06:14.193381000 -0500
++++ bridges/source/cpp_uno/gcc3_linux_powerpc64/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 );
diff --git a/editors/libreoffice/files/powerpc64/patch-cppuhelper_source_exc__thrower.cxx b/editors/libreoffice/files/powerpc64/patch-cppuhelper_source_exc__thrower.cxx
new file mode 100644
index 000000000000..a014ac21285d
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-cppuhelper_source_exc__thrower.cxx
@@ -0,0 +1,10 @@
+--- cppuhelper/source/exc_thrower.cxx.orig 2020-11-27 22:07:39 UTC
++++ cppuhelper/source/exc_thrower.cxx
+@@ -220,6 +220,7 @@ namespace cppu
+ {
+
+
++__attribute__ ((optnone))
+ void SAL_CALL throwException( Any const & exc )
+ {
+ if (exc.getValueTypeClass() != TypeClass_EXCEPTION)
diff --git a/editors/libreoffice/files/powerpc64/patch-desktop_source_deployment_misc_dp__ucb.cxx b/editors/libreoffice/files/powerpc64/patch-desktop_source_deployment_misc_dp__ucb.cxx
new file mode 100644
index 000000000000..2b04882f8ff7
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-desktop_source_deployment_misc_dp__ucb.cxx
@@ -0,0 +1,20 @@
+--- desktop/source/deployment/misc/dp_ucb.cxx.orig 2020-10-21 20:09:11 UTC
++++ desktop/source/deployment/misc/dp_ucb.cxx
+@@ -45,7 +45,7 @@ namespace dp_misc
+ bool create_ucb_content(
+ ::ucbhelper::Content * ret_ucbContent, OUString const & url,
+ Reference<XCommandEnvironment> const & xCmdEnv,
+- bool throw_exc )
++ bool throw_exc ) __attribute__ ((optnone))
+ {
+ try {
+ // Existence check...
+@@ -81,7 +81,7 @@ bool create_ucb_content(
+
+ bool create_folder(
+ ::ucbhelper::Content * ret_ucb_content, OUString const & url_,
+- Reference<XCommandEnvironment> const & xCmdEnv, bool throw_exc )
++ Reference<XCommandEnvironment> const & xCmdEnv, bool throw_exc ) __attribute__ ((optnone))
+ {
+ ::ucbhelper::Content ucb_content;
+ if (create_ucb_content(
diff --git a/editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.h b/editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.h
new file mode 100644
index 000000000000..03ba05e9815e
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.h
@@ -0,0 +1,11 @@
+--- include/com/sun/star/uno/Reference.h.orig 2020-11-27 17:16:53 UTC
++++ include/com/sun/star/uno/Reference.h
+@@ -377,7 +377,7 @@ class SAL_DLLPUBLIC_RTTI Reference : public BaseRefere
+
+ @return UNacquired interface pointer
+ */
+- interface_type * SAL_CALL operator -> () const {
++ interface_type * SAL_CALL operator -> () const __attribute__ ((optnone)) {
+ assert(_pInterface != NULL);
+ return castFromXInterface(_pInterface);
+ }
diff --git a/editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.hxx b/editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.hxx
new file mode 100644
index 000000000000..928ec1e06012
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-include_com_sun_star_uno_Reference.hxx
@@ -0,0 +1,20 @@
+--- include/com/sun/star/uno/Reference.hxx.orig 2020-10-21 20:09:11 UTC
++++ include/com/sun/star/uno/Reference.hxx
+@@ -91,7 +91,7 @@ inline XInterface * Reference< interface_type >::iquer
+
+ template< class interface_type >
+ inline interface_type * Reference< interface_type >::iset_throw(
+- interface_type * pInterface )
++ interface_type * pInterface ) __attribute__ ((optnone))
+ {
+ if (pInterface)
+ {
+@@ -104,7 +104,7 @@ inline interface_type * Reference< interface_type >::i
+ }
+
+ template< class interface_type >
+-inline Reference< interface_type >::~Reference() COVERITY_NOEXCEPT_FALSE
++inline Reference< interface_type >::~Reference() COVERITY_NOEXCEPT_FALSE __attribute__ ((optnone))
+ {
+ if (_pInterface)
+ _pInterface->release();
diff --git a/editors/libreoffice/files/powerpc64/patch-include_uno_mapping.hxx b/editors/libreoffice/files/powerpc64/patch-include_uno_mapping.hxx
new file mode 100644
index 000000000000..04342a17f3b0
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-include_uno_mapping.hxx
@@ -0,0 +1,10 @@
+--- include/uno/mapping.hxx.orig 2020-11-28 00:12:11 UTC
++++ include/uno/mapping.hxx
+@@ -248,6 +248,7 @@ inline Mapping::Mapping( const Mapping & rMapping )
+ (*_pMapping->acquire)( _pMapping );
+ }
+
++__attribute__ ((optnone))
+ inline Mapping::~Mapping()
+ {
+ if (_pMapping)
diff --git a/editors/libreoffice/files/powerpc64/patch-ucb_source_ucp_file_bc.cxx b/editors/libreoffice/files/powerpc64/patch-ucb_source_ucp_file_bc.cxx
new file mode 100644
index 000000000000..8a8782166c42
--- /dev/null
+++ b/editors/libreoffice/files/powerpc64/patch-ucb_source_ucp_file_bc.cxx
@@ -0,0 +1,10 @@
+--- ucb/source/ucp/file/bc.cxx.orig 2020-12-08 05:01:04 UTC
++++ ucb/source/ucp/file/bc.cxx
+@@ -40,6 +40,7 @@
+ #include "prov.hxx"
+ #include "filerror.hxx"
+ #include "filinsreq.hxx"
++#pragma clang optimize off
+
+ using namespace fileaccess;
+ using namespace com::sun::star;