View | Details | Raw Unified | Return to bug 247165
Collapse All | Expand All

(-)editors/libreoffice/Makefile (-1 / +1 lines)
Lines 96-102 Link Here
96
DISTFILES+=	4b87018f7fff1d054939d19920b751a0-collada2gltf-master-cb1d97788a.tar.bz2:src \
96
DISTFILES+=	4b87018f7fff1d054939d19920b751a0-collada2gltf-master-cb1d97788a.tar.bz2:src \
97
		884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf:ext
97
		884ed41809687c3e168fc7c19b16585149ff058eca79acbf3ee784f6630704cc-opens___.ttf:ext
98
98
99
NOT_FOR_ARCHS=		aarch64 armv6 armv7
99
NOT_FOR_ARCHS=		armv6 armv7
100
NOT_FOR_ARCHS_REASON=	Unsupported host_cpu
100
NOT_FOR_ARCHS_REASON=	Unsupported host_cpu
101
101
102
.if defined(PRERELEASE)
102
.if defined(PRERELEASE)
(-)editors/libreoffice/files/patch-aarch64-gcc3_linux_aarch64 (+274 lines)
Line 0 Link Here
1
From 189d498f5c0c633f8cd87b3f1b6d57020371a952 Mon Sep 17 00:00:00 2001
2
From: Stephan Bergmann <sbergman@redhat.com>
3
Date: Tue, 17 Dec 2019 23:33:28 +0100
4
Subject: [PATCH] tdf#128671: Rely on unwind.h, declare what's missing from
5
 cxxabi.h
6
7
...for gcc3_linux_aarch64, similar to what
8
128deeae81a6f802bfb79b8f0fa8c4b10729f7db "cxxabi.h is not specific to GCC" et al
9
did for gcc3_linux_x86-64
10
11
Change-Id: Iee9980842c0e5f6f49642407339a67e865f8be9c
12
Reviewed-on: https://gerrit.libreoffice.org/85344
13
Tested-by: Jenkins
14
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
15
---
16
 .../source/cpp_uno/gcc3_linux_aarch64/abi.cxx |   7 +-
17
 .../source/cpp_uno/gcc3_linux_aarch64/abi.hxx | 117 +++++++++++++-----
18
 .../cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx    |   4 +-
19
 3 files changed, 92 insertions(+), 36 deletions(-)
20
21
diff --git bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
22
index 938011a09a2e..892bf6e81963 100644
23
--- bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
24
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
25
@@ -24,7 +24,6 @@
26
 #include <cstring>
27
 #include <typeinfo>
28
 
29
-#include <cxxabi.h>
30
 #include <dlfcn.h>
31
 
32
 #include <com/sun/star/uno/RuntimeException.hpp>
33
@@ -135,8 +134,8 @@ std::type_info * getRtti(typelib_TypeDescription const & type) {
34
 }
35
 
36
 extern "C" void _GLIBCXX_CDTOR_CALLABI deleteException(void * exception) {
37
-    abi_aarch64::__cxa_exception * header =
38
-        static_cast<abi_aarch64::__cxa_exception *>(exception) - 1;
39
+    __cxxabiv1::__cxa_exception * header =
40
+        static_cast<__cxxabiv1::__cxa_exception *>(exception) - 1;
41
     OUString unoName(toUnoName(header->exceptionType->name()));
42
     typelib_TypeDescription * td = 0;
43
     typelib_typedescription_getByName(&td, unoName.pData);
44
@@ -224,7 +223,7 @@ StructKind getStructKind(typelib_CompoundTypeDescription const * type) {
45
 namespace abi_aarch64 {
46
 
47
 void mapException(
48
-    __cxa_exception * exception, std::type_info const * type, uno_Any * any, uno_Mapping * mapping)
49
+    __cxxabiv1::__cxa_exception * exception, std::type_info const * type, uno_Any * any, uno_Mapping * mapping)
50
 {
51
     assert(exception != 0);
52
     assert(type != nullptr);
53
diff --git bridges/source/cpp_uno/gcc3_linux_aarch64/abi.hxx bridges/source/cpp_uno/gcc3_linux_aarch64/abi.hxx
54
index 50c5f1f21a37..e3dc9b5872a7 100644
55
--- bridges/source/cpp_uno/gcc3_linux_aarch64/abi.hxx
56
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/abi.hxx
57
@@ -22,55 +22,114 @@
58
 
59
 #include <sal/config.h>
60
 
61
+#include <cstddef>
62
 #include <exception>
63
 #include <typeinfo>
64
 
65
+#include <cxxabi.h>
66
+#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
67
+#define _GLIBCXX_CDTOR_CALLABI
68
+#endif
69
+#include <unwind.h>
70
+
71
+#include <config_cxxabi.h>
72
 #include <typelib/typedescription.h>
73
 #include <uno/any2.h>
74
 #include <uno/mapping.h>
75
 
76
-namespace abi_aarch64 {
77
-
78
-// Following declarations from libstdc++-v3/libsupc++/unwind-cxx.h and
79
-// lib/gcc/*-*-*/*/include/unwind.h:
80
-
81
-struct _Unwind_Exception
82
-{
83
-    unsigned exception_class __attribute__((__mode__(__DI__)));
84
-    void * exception_cleanup;
85
-    unsigned private_1 __attribute__((__mode__(__word__)));
86
-    unsigned private_2 __attribute__((__mode__(__word__)));
87
-} __attribute__((__aligned__));
88
+#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
89
+// <https://mentorembedded.github.io/cxx-abi/abi.html>,
90
+// libstdc++-v3/libsupc++/cxxabi.h:
91
+namespace __cxxabiv1 {
92
+class __class_type_info: public std::type_info {
93
+public:
94
+    explicit __class_type_info(char const * n): type_info(n) {}
95
+    ~__class_type_info() override;
96
+};
97
+}
98
+#endif
99
 
100
-struct __cxa_exception
101
-{
102
-    std::type_info *exceptionType;
103
-    void (*exceptionDestructor)(void *);
104
+#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
105
+// <https://mentorembedded.github.io/cxx-abi/abi.html>,
106
+// libstdc++-v3/libsupc++/cxxabi.h:
107
+namespace __cxxabiv1 {
108
+class __si_class_type_info: public __class_type_info {
109
+public:
110
+    __class_type_info const * __base_type;
111
+    explicit __si_class_type_info(
112
+        char const * n, __class_type_info const *base):
113
+        __class_type_info(n), __base_type(base) {}
114
+    ~__si_class_type_info() override;
115
+};
116
+}
117
+#endif
118
 
119
+#if !HAVE_CXXABI_H_CXA_EXCEPTION
120
+// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>,
121
+// libcxxabi/src/cxa_exception.hpp:
122
+namespace __cxxabiv1 {
123
+struct __cxa_exception {
124
+#if defined _LIBCPPABI_VERSION // detect libc++abi
125
+#if defined __LP64__ || LIBCXXABI_ARM_EHABI
126
+    std::size_t referenceCount;
127
+#endif
128
+#endif
129
+    std::type_info * exceptionType;
130
+    void (* exceptionDestructor)(void *);
131
     void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
132
     std::terminate_handler terminateHandler;
133
-
134
-    __cxa_exception *nextException;
135
-
136
+    __cxa_exception * nextException;
137
     int handlerCount;
138
-
139
     int handlerSwitchValue;
140
-    const unsigned char *actionRecord;
141
-    const unsigned char *languageSpecificData;
142
-    void *catchTemp;
143
-    void *adjustedPtr;
144
-
145
+    char const * actionRecord;
146
+    char const * languageSpecificData;
147
+    void * catchTemp;
148
+    void * adjustedPtr;
149
     _Unwind_Exception unwindHeader;
150
 };
151
+}
152
+#endif
153
 
154
-struct __cxa_eh_globals
155
-{
156
-    __cxa_exception *caughtExceptions;
157
+#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
158
+// <https://mentorembedded.github.io/cxx-abi/abi-eh.html>:
159
+namespace __cxxabiv1 {
160
+struct __cxa_eh_globals {
161
+    __cxa_exception * caughtExceptions;
162
     unsigned int uncaughtExceptions;
163
 };
164
+}
165
+#endif
166
+
167
+#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
168
+namespace __cxxabiv1 {
169
+extern "C" __cxa_eh_globals * __cxa_get_globals() throw();
170
+}
171
+#endif
172
+
173
+#if !HAVE_CXXABI_H_CXA_CURRENT_EXCEPTION_TYPE
174
+namespace __cxxabiv1 {
175
+extern "C" std::type_info *__cxa_current_exception_type() throw();
176
+}
177
+#endif
178
+
179
+#if !HAVE_CXXABI_H_CXA_ALLOCATE_EXCEPTION
180
+namespace __cxxabiv1 {
181
+extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
182
+}
183
+#endif
184
+
185
+#if !HAVE_CXXABI_H_CXA_THROW
186
+namespace __cxxabiv1 {
187
+extern "C" void __cxa_throw(
188
+    void * thrown_exception, void * tinfo, void (* dest)(void *))
189
+    __attribute__((noreturn));
190
+}
191
+#endif
192
+
193
+namespace abi_aarch64 {
194
 
195
 void mapException(
196
-    __cxa_exception * exception, std::type_info const * type, uno_Any * any, uno_Mapping * mapping);
197
+    __cxxabiv1::__cxa_exception * exception, std::type_info const * type, uno_Any * any, uno_Mapping * mapping);
198
 
199
 void raiseException(uno_Any * any, uno_Mapping * mapping);
200
 
201
diff --git bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
202
index f03d848521cc..0847dfc76db5 100644
203
--- bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
204
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/uno2cpp.cxx
205
@@ -24,8 +24,6 @@
206
 #include <exception>
207
 #include <typeinfo>
208
 
209
-#include <cxxabi.h>
210
-
211
 #include <bridge.hxx>
212
 #include <types.hxx>
213
 #include <unointerfaceproxy.hxx>
214
@@ -190,7 +188,7 @@ void call(
215
         }
216
     } catch (css::uno::Exception &) {
217
         abi_aarch64::mapException(
218
-            reinterpret_cast<abi_aarch64::__cxa_eh_globals *>(
219
+            reinterpret_cast<__cxxabiv1::__cxa_eh_globals *>(
220
                 __cxxabiv1::__cxa_get_globals())->caughtExceptions,
221
             __cxxabiv1::__cxa_current_exception_type(), *exception,
222
             proxy->getBridge()->getCpp2Uno());
223
From a7d1fed24557b203acb5016a98af26f4ef24d27a Mon Sep 17 00:00:00 2001
224
From: Stephan Bergmann <sbergman@redhat.com>
225
Date: Tue, 11 Feb 2020 15:46:45 +0100
226
Subject: [PATCH] Hack to dynamically adapt to __cxa_exceptiom in LLVM 5.0
227
 libcxxabi
228
229
...for Linux aarch64, similar to 7a9dd3d482deeeb3ed1d50074e56adbd3f928296 "Hack
230
to dynamically adapt to __cxa_exceptiom in LLVM 5.0 libcxxabi" for macOS x86-64.
231
But unlike on macOS (which is known to always use libcxxabi), be careful to only
232
execute the hack in builds targeting libcxxabi.
233
234
Change-Id: I5417fde425d2d6bac9400592193a9fe5d2bfe175
235
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88458
236
Tested-by: Jenkins
237
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
238
---
239
 .../source/cpp_uno/gcc3_linux_aarch64/abi.cxx | 22 +++++++++++++++++++
240
 1 file changed, 22 insertions(+)
241
242
diff --git bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
243
index 892bf6e81963..611442a31e31 100644
244
--- bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
245
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/abi.cxx
246
@@ -136,6 +136,28 @@ std::type_info * getRtti(typelib_TypeDescription const & type) {
247
 extern "C" void _GLIBCXX_CDTOR_CALLABI deleteException(void * exception) {
248
     __cxxabiv1::__cxa_exception * header =
249
         static_cast<__cxxabiv1::__cxa_exception *>(exception) - 1;
250
+#if defined _LIBCPPABI_VERSION // detect libc++abi
251
+    // The libcxxabi commit
252
+    // <http://llvm.org/viewvc/llvm-project?view=revision&revision=303175>
253
+    // "[libcxxabi] Align unwindHeader on a double-word boundary" towards
254
+    // LLVM 5.0 changed the size of __cxa_exception by adding
255
+    //
256
+    //   __attribute__((aligned))
257
+    //
258
+    // to the final member unwindHeader, on x86-64 effectively adding a hole of
259
+    // size 8 in front of that member (changing its offset from 88 to 96,
260
+    // sizeof(__cxa_exception) from 120 to 128, and alignof(__cxa_exception)
261
+    // from 8 to 16); a hack to dynamically determine whether we run against a
262
+    // new libcxxabi is to look at the exceptionDestructor member, which must
263
+    // point to this function (the use of __cxa_exception in fillUnoException is
264
+    // unaffected, as it only accesses members towards the start of the struct,
265
+    // through a pointer known to actually point at the start):
266
+    if (header->exceptionDestructor != &deleteException) {
267
+        header = reinterpret_cast<__cxa_exception const *>(
268
+            reinterpret_cast<char const *>(header) - 8);
269
+        assert(header->exceptionDestructor == &deleteException);
270
+    }
271
+#endif
272
     OUString unoName(toUnoName(header->exceptionType->name()));
273
     typelib_TypeDescription * td = 0;
274
     typelib_typedescription_getByName(&td, unoName.pData);
(-)editors/libreoffice/files/patch-bridges_source_cpp__uno_gcc3__linux__aarch64_cpp2uno.cxx (+22 lines)
Line 0 Link Here
1
--- bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx.orig	2020-03-11 17:18:35 UTC
2
+++ bridges/source/cpp_uno/gcc3_linux_aarch64/cpp2uno.cxx
3
@@ -321,9 +321,16 @@ extern "C" void vtableSlotCall(
4
     double fpr2, double fpr3, double fpr4, double fpr5, double fpr6,
5
     double fpr7, ...)
6
 {
7
-    register void * volatile indirectRet asm ("x8");
8
-    register sal_Int32 volatile functionIndex asm ("x9");
9
-    register sal_Int32 volatile vtableOffset asm ("x10");
10
+    void * volatile indirectRet;
11
+    sal_Int32 volatile functionIndex, vtableOffset;
12
+
13
+    asm volatile(
14
+        "mov %0, x8\n"
15
+        "mov %1, x9\n"
16
+        "mov %2, x10\n"
17
+        : "=r" (indirectRet), "=r" (functionIndex), "=r" (vtableOffset)
18
+        ::);
19
+
20
     va_list ap;
21
     va_start(ap, fpr7);
22
     assert(sizeof (va_list) == sizeof (aarch64_va_list));
(-)editors/libreoffice/files/patch-configure.aarch64 (+14 lines)
Line 0 Link Here
1
--- configure.orig	2020-04-06 14:49:31.976007000 +0200
2
+++ configure	2020-04-06 14:50:04.326755000 +0200
3
@@ -12532,6 +12532,11 @@ freebsd*)
4
         RTL_ARCH=X86_64
5
         PLATFORMID=freebsd_x86_64
6
         ;;
7
+     aarch64)
8
+         CPUNAME=AARCH64
9
+         PLATFORMID=freebsd_aarch64
10
+         RTL_ARCH=AARCH64
11
+         ;;
12
     *)
13
         as_fn_error $? "Unsupported host_cpu $host_cpu for host_os $host_os" "$LINENO" 5
14
         ;;
(-)editors/libreoffice/files/patch-cxa_exception (+76 lines)
Line 0 Link Here
1
From 97d736d27435fb26d5609000f77bd79ece08572e Mon Sep 17 00:00:00 2001
2
From: Stephan Bergmann <sbergman@redhat.com>
3
Date: Wed, 18 Dec 2019 10:59:46 +0100
4
Subject: [PATCH] Fix typos concerning the __cxa_exception check
5
6
...introduced with 069506bcb0ee4005b01c22095ed427b96b553c98 "Use config_cxxabi.h
7
to check for __cxa_eh_globals, __cxa_exception", but which appear to have been
8
harmless as (a) the checked-for __cxxabiv1::__cxa_exceptions never existed in
9
cxxabi.h, and (b) lack of __cxxabiv1::__cxa_exception in cxxabi.h happened to
10
conincide with !HAVE_CXXABI_H_CXA_EH_GLOBALS
11
12
Change-Id: I13f8a2b3cf0f03f2bc96cf053d2b571860055978
13
Reviewed-on: https://gerrit.libreoffice.org/85373
14
Tested-by: Jenkins
15
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
16
---
17
 bridges/source/cpp_uno/gcc3_linux_arm/share.hxx    | 2 +-
18
 bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx | 2 +-
19
 configure.ac                                       | 6 +++---
20
 3 files changed, 5 insertions(+), 5 deletions(-)
21
22
diff --git bridges/source/cpp_uno/gcc3_linux_arm/share.hxx bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
23
index ac380969e21b..0faa612d92fd 100644
24
--- bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
25
+++ bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
26
@@ -60,7 +60,7 @@ public:
27
 }
28
 #endif
29
 
30
-#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
31
+#if !HAVE_CXXABI_H_CXA_EXCEPTION
32
 namespace __cxxabiv1 {
33
     struct __cxa_exception
34
     {
35
diff --git bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
36
index 864173470476..e8afe35c4f59 100644
37
--- bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
38
+++ bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
39
@@ -101,7 +101,7 @@ public:
40
 }
41
 #endif
42
 
43
-#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
44
+#if !HAVE_CXXABI_H_CXA_EXCEPTION
45
 // <https://mentorembedded.github.io/cxx-abi/abi-eh.html>,
46
 // libcxxabi/src/cxa_exception.hpp:
47
 namespace __cxxabiv1 {
48
--- configure.orig	2020-04-09 11:53:22.480526000 +0200
49
+++ configure	2020-04-09 11:57:59.716479000 +0200
50
@@ -17696,8 +17696,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $
51
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
52
 
53
 
54
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX defines __cxa_exceptions in cxxabi.h" >&5
55
-$as_echo_n "checking whether $CXX defines __cxa_exceptions in cxxabi.h... " >&6; }
56
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX defines __cxa_exception in cxxabi.h" >&5
57
+$as_echo_n "checking whether $CXX defines __cxa_exception in cxxabi.h... " >&6; }
58
     ac_ext=cpp
59
 ac_cpp='$CXXCPP $CPPFLAGS'
60
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
61
@@ -17695,12 +17705,12 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
62
 
63
             #include <cstddef>
64
             #include <cxxabi.h>
65
-            std::size_t f() { return sizeof(__cxxabiv1::__cxa_exceptions); }
66
+            std::size_t f() { return sizeof(__cxxabiv1::__cxa_exception); }
67
 
68
 _ACEOF
69
 if ac_fn_cxx_try_compile "$LINENO"; then :
70
 
71
-            $as_echo "#define HAVE_CXXABI_H_CXA_EXCEPTIONS 1" >>confdefs.h
72
+            $as_echo "#define HAVE_CXXABI_H_CXA_EXCEPTION 1" >>confdefs.h
73
 
74
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
75
 $as_echo "yes" >&6; }
76
(-)editors/libreoffice/files/patch-solenv_gbuild_platform_FREEBSD__AARCH64__GCC.mk (+17 lines)
Line 0 Link Here
1
--- solenv/gbuild/platform/FREEBSD_AARCH64_GCC.mk.orig	2020-04-07 17:58:54.600930000 +0200
2
+++ solenv/gbuild/platform/FREEBSD_AARCH64_GCC.mk	2020-04-07 18:01:04.452566000 +0200
3
@@ -0,0 +1,14 @@
4
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
5
+#
6
+# This file is part of the LibreOffice project.
7
+#
8
+# This Source Code Form is subject to the terms of the Mozilla Public
9
+# License, v. 2.0. If a copy of the MPL was not distributed with this
10
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
11
+#
12
+
13
+#please make generic modifications to unxgcc.mk
14
+
15
+include $(GBUILDDIR)/platform/unxgcc.mk
16
+
17
+# vim: set noet sw=4:

Return to bug 247165