Gentoo Archives: gentoo-commits

From: Yixun Lan <dlan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/riscv:master commit in: app-office/libreoffice/, app-office/libreoffice/files/
Date: Thu, 01 Dec 2022 11:38:56
Message-Id: 1669894549.6aef1b70c70a0b4060659f8798568157a0c8b520.dlan@gentoo
1 commit: 6aef1b70c70a0b4060659f8798568157a0c8b520
2 Author: Yixun Lan <dlan <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 1 11:35:49 2022 +0000
4 Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 1 11:35:49 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/riscv.git/commit/?id=6aef1b70
7
8 app-office/libreoffice: import 7.3.7.2 from portage tree
9
10 Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>
11
12 app-office/libreoffice/Manifest | 4 +-
13 .../libreoffice-7.2.6.2-poppler-22.03.0.patch | 33 -
14 ...Add-missing-nSize-set-for-Poppler-22.04.0.patch | 31 -
15 ...t-FreeBSD-patch-for-Poppler-22.04.0-build.patch | 78 -
16 .../files/libreoffice-7.3.6.2-riscv64.patch | 1964 --------------------
17 ...e-7.3.6.2.ebuild => libreoffice-7.3.7.2.ebuild} | 8 +-
18 6 files changed, 3 insertions(+), 2115 deletions(-)
19
20 diff --git a/app-office/libreoffice/Manifest b/app-office/libreoffice/Manifest
21 index e41d0f5..691b425 100644
22 --- a/app-office/libreoffice/Manifest
23 +++ b/app-office/libreoffice/Manifest
24 @@ -18,7 +18,7 @@ DIST eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip 427800 BLAKE2B d3ac085a3
25 DIST f94d9870737518e3b597f9265f4e9803-libserializer-1.1.6.zip 211919 BLAKE2B 2c72493e44d3ad1714d294fb7baaa85d33fef2eb4ce75bf507b65f78f1d9d399bb5eb72cee188a8abc4b234eb2845a26755791fb3ac104ffe6e55013ab41ca8b SHA512 c1a15ebbfe817ec79d4b3f1c97d096bf8511737d7d35d97302856ccfb3de14a1cd16bd31000415d9ab24bbd9ef770d37855cee4b819ff0e8fca2f2766920a114
26 DIST libcmis-0.5.2.tar.xz 484404 BLAKE2B 7de242393c28fc8289bb598b34e704eb2affaaa8b9e470e10044dbfd3812391f29e1421df8d7ac3869955698ddbc9575feebcfbac27bb074a60ccc0527dca1c3 SHA512 295ab15115e75b1f6074f17d3538afe0de9b2b77ab454f5c63cb05e8df11886d82942fbf21ba01486052e3f6c75b0636b99d8e660cd3472dc4b87c31d3cd557b
27 DIST libreoffice-7.3.5.2-patchset-01.tar.xz 12700 BLAKE2B 353f6552d31616dfeb32287173bbd70366045ec437c8735e701bff357032f5ef2358920c5d8495142551116999b034db6611a72536edf14fe13ea9cace3a931c SHA512 dbd8b4b494159845efbe9ad76d5822188b9868aff8ef488793f4e2b0f2f0290942322651e8b53dd71db81cba559e3510732801d0c643cb2af9526cb1e1837891
28 -DIST libreoffice-7.3.6.2.tar.xz 256616324 BLAKE2B 52456e529ae2898101824882f124a5b039a1dfb98fd77dfceef39a41a3af871123c56b83a73d0aaf92e1cea57f35af442ca0a17814a1374538a9495ac601cee0 SHA512 8f61e9c09b344cf120bc6f9463344b28644e52738360ddeb1a29d9d2294d24132b070902a089531869e11487f5a7153fc4752e6636af7ef57269d23c8187ec86
29 +DIST libreoffice-7.3.7.2.tar.xz 256653492 BLAKE2B aa3e096ba46d6e23b0e6439a435a6d75fdc9da309885a28d96dc5a4fc05d854a8e4f633d9f4d623af18f6a80ca036409fb26b9a9843fb9a18144468b58ef5ad4 SHA512 f7b6279f5ef9f5ad8290d2bdf4fd54f8df7775a21094ba762dbd9299effab31d4f2c6dff9f4b3d9c5673596931df1d16b195474b547007bfc9a396c47e5e181c
30 DIST libreoffice-branding-gentoo-0.8.tar.xz 151568 BLAKE2B f03c7ddeb53c5ca3fd23401679601fcf2c4037ba17be4eb7b784c7ce7ebb71a24b8ab4aac8b7da8c6b1f14dd23bc1294ba85ff4f70ad271fb4ee3c5372e10883 SHA512 785031a699b1d1895ce4b50ffc3ddf645f3a0ef9acdf37facfd18cf75db9484cb8f53a50abb63d6006ead76a80b6ff5aa99661063245ebb84bd64013d713de7f
31 -DIST libreoffice-help-7.3.6.2.tar.xz 112209384 BLAKE2B 629a9dae6464adb33ed4494df8cbf59305a686b0bab21d55e3c139b87c5e3eee3e77ef1f22be84973d6e51a1ffb74aa74fd7f91b82223b2e3cc6d3bc900e7305 SHA512 7a98e8d3b146638bdb608d86b617bb45ff2649957ad9391aadfbb32fb18a4c8d15675bd24076dbb2b635569bfdab988f7cac461cfe04e53b3febfb2aa35d6189
32 +DIST libreoffice-help-7.3.7.2.tar.xz 112210852 BLAKE2B 3a3148d6ff9c743c97c0371290b3264f8e9eb8eb5aba3176b2e88f296abc2856f364866ba6ebb9f6364b5c98255c8593d23e3d54db6bcc27eecde53ac9a1b393 SHA512 c223ee49626e36b11a86c077001efc27ca2df9aa10ddb068e04c8ab8a0ea1942ca71b97c2f7379bf856ba7d12a5ca94f2fd8d8058703e2276af3595b75049030
33 DIST skia-m97-a7230803d64ae9d44f4e1282444801119a3ae967.tar.xz 11826600 BLAKE2B 2985ba0318fd72ac216fda33c6961eaa8ee649d2a850eb736accbd91fbc9cee7dc4e5752b2696a35204770a188412e2ecd0cc128cec324c682f9bc35e68358b3 SHA512 fbf5cfef66991565dbad928091a4e795a5b5b79a1e062a98ab9135b9972827de703c449507957294e7471c422c2e2ed239d6df61ffb9b9581a9ca3d848687a76
34
35 diff --git a/app-office/libreoffice/files/libreoffice-7.2.6.2-poppler-22.03.0.patch b/app-office/libreoffice/files/libreoffice-7.2.6.2-poppler-22.03.0.patch
36 deleted file mode 100644
37 index be4a399..0000000
38 --- a/app-office/libreoffice/files/libreoffice-7.2.6.2-poppler-22.03.0.patch
39 +++ /dev/null
40 @@ -1,33 +0,0 @@
41 -From 001ec0e10616a3a55fa7898bb68c983e94b7ce66 Mon Sep 17 00:00:00 2001
42 -From: foutrelis <foutrelis@eb2447ed-0c53-47e4-bac8-5bc4a241df78>
43 -Date: Wed, 2 Mar 2022 12:58:09 +0000
44 -Subject: [PATCH] upgpkg: libreoffice-fresh 7.3.0-7: poppler 22.03.0 rebuild
45 -
46 -diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
47 -index ad6320139..e5f6d9c68 100644
48 ---- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
49 -+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
50 -@@ -138,6 +138,15 @@ int main(int argc, char **argv)
51 - _setmode( _fileno( g_binary_out ), _O_BINARY );
52 - #endif
53 -
54 -+#if POPPLER_CHECK_VERSION(22, 3, 0)
55 -+ PDFDoc aDoc( std::make_unique<GooString>(pFileName),
56 -+ GooString(pOwnerPasswordStr),
57 -+ GooString(pUserPasswordStr) );
58 -+
59 -+ PDFDoc aErrDoc( std::make_unique<GooString>(pErrFileName),
60 -+ GooString(pOwnerPasswordStr),
61 -+ GooString(pUserPasswordStr) );
62 -+#else
63 - PDFDoc aDoc( pFileName,
64 - pOwnerPasswordStr,
65 - pUserPasswordStr );
66 -@@ -145,6 +154,7 @@ int main(int argc, char **argv)
67 - PDFDoc aErrDoc( pErrFileName,
68 - pOwnerPasswordStr,
69 - pUserPasswordStr );
70 -+#endif
71 -
72 - // Check various permissions for aDoc.
73 - PDFDoc &rDoc = aDoc.isOk()? aDoc: aErrDoc;
74
75 diff --git a/app-office/libreoffice/files/libreoffice-7.3.3.2-Add-missing-nSize-set-for-Poppler-22.04.0.patch b/app-office/libreoffice/files/libreoffice-7.3.3.2-Add-missing-nSize-set-for-Poppler-22.04.0.patch
76 deleted file mode 100644
77 index 22de747..0000000
78 --- a/app-office/libreoffice/files/libreoffice-7.3.3.2-Add-missing-nSize-set-for-Poppler-22.04.0.patch
79 +++ /dev/null
80 @@ -1,31 +0,0 @@
81 -https://bugs.gentoo.org/843311
82 -
83 -From: Sam James <sam@g.o>
84 -Date: Sun, 8 May 2022 21:22:49 +0000
85 -Subject: [PATCH] Add missing nSize set for Poppler 22.04.0
86 -
87 -Thanks-to: Stephan Hartmann <sultan@g.o>
88 ---- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
89 -+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
90 -@@ -478,6 +478,10 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, const GfxState* st
91 - char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
92 - #else
93 - std::optional<std::vector<unsigned char>> pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef() );
94 -+ if( pBuf )
95 -+ {
96 -+ nSize = pBuf->size();
97 -+ }
98 - #endif
99 - if( pBuf )
100 - {
101 -@@ -502,6 +506,10 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const
102 - char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
103 - #else
104 - std::optional<std::vector<unsigned char>> pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef() );
105 -+ if( pBuf )
106 -+ {
107 -+ nSize = pBuf->size();
108 -+ }
109 - #endif
110 - if( !pBuf )
111 - return;
112
113 diff --git a/app-office/libreoffice/files/libreoffice-7.3.3.2-Import-FreeBSD-patch-for-Poppler-22.04.0-build.patch b/app-office/libreoffice/files/libreoffice-7.3.3.2-Import-FreeBSD-patch-for-Poppler-22.04.0-build.patch
114 deleted file mode 100644
115 index 39cb13b..0000000
116 --- a/app-office/libreoffice/files/libreoffice-7.3.3.2-Import-FreeBSD-patch-for-Poppler-22.04.0-build.patch
117 +++ /dev/null
118 @@ -1,78 +0,0 @@
119 -https://bugs.gentoo.org/843311
120 -https://cgit.freebsd.org/ports/commit/?id=d9b5ef800dbd0366eae81b03bfa89689ec73c6f7
121 -
122 -(sam: adapt version check to 22.4.0)
123 -
124 -From: Sam James <sam@g.o>
125 -Date: Sun, 8 May 2022 21:20:25 +0000
126 -Subject: [PATCH 1/2] Import FreeBSD patch for Poppler 22.04.0 build
127 -
128 ---- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
129 -+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
130 -@@ -474,11 +474,17 @@ int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, const GfxState* st
131 - {
132 - // TODO(P3): Unfortunately, need to read stream twice, since
133 - // we must write byte count to stdout before
134 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
135 - char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
136 -+#else
137 -+ std::optional<std::vector<unsigned char>> pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef() );
138 -+#endif
139 - if( pBuf )
140 - {
141 - aNewFont.isEmbedded = true;
142 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
143 - gfree(pBuf);
144 -+#endif
145 - }
146 - }
147 -
148 -@@ -492,21 +498,32 @@ void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const
149 - return;
150 -
151 - int nSize = 0;
152 -- char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
153 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
154 -+ char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize );
155 -+#else
156 -+ std::optional<std::vector<unsigned char>> pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef() );
157 -+#endif
158 - if( !pBuf )
159 - return;
160 -
161 - // ---sync point--- see SYNC STREAMS above
162 - fflush(stdout);
163 --
164 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
165 - if( fwrite(pBuf, sizeof(char), nSize, g_binary_out) != static_cast<size_t>(nSize) )
166 -+#else
167 -+ if( fwrite(reinterpret_cast<char*>(pBuf.value().data()), sizeof(char), nSize, g_binary_out) != static_cast<size_t>(nSize) )
168 -+#endif
169 - {
170 -- gfree(pBuf);
171 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
172 -+ gfree(pBuf);
173 -+#endif
174 - exit(1); // error
175 - }
176 - // ---sync point--- see SYNC STREAMS above
177 - fflush(g_binary_out);
178 -- gfree(pBuf);
179 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
180 -+ gfree(pBuf);
181 -+#endif
182 - }
183 -
184 - #if POPPLER_CHECK_VERSION(0, 83, 0)
185 -@@ -759,7 +776,11 @@ void PDFOutDev::updateFont(GfxState *state)
186 - {
187 - assert(state);
188 -
189 -+#if !POPPLER_CHECK_VERSION(22, 4, 0)
190 - GfxFont *gfxFont = state->getFont();
191 -+#else
192 -+ GfxFont *gfxFont = state->getFont().get();
193 -+#endif
194 - if( !gfxFont )
195 - return;
196 -
197
198 diff --git a/app-office/libreoffice/files/libreoffice-7.3.6.2-riscv64.patch b/app-office/libreoffice/files/libreoffice-7.3.6.2-riscv64.patch
199 deleted file mode 100644
200 index 0937fbe..0000000
201 --- a/app-office/libreoffice/files/libreoffice-7.3.6.2-riscv64.patch
202 +++ /dev/null
203 @@ -1,1964 +0,0 @@
204 -Subject: [PATCH] libreoffice-riscv64
205 -
206 -https://gerrit.libreoffice.org/c/core/+/137445
207 -
208 ----
209 - bridges/Library_cpp_uno.mk | 9 +
210 - .../cpp_uno/gcc3_linux_riscv64/call.hxx | 35 +
211 - .../source/cpp_uno/gcc3_linux_riscv64/call.s | 72 ++
212 - .../cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx | 723 ++++++++++++++++++
213 - .../cpp_uno/gcc3_linux_riscv64/except.cxx | 297 +++++++
214 - .../cpp_uno/gcc3_linux_riscv64/share.hxx | 89 +++
215 - .../cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx | 595 ++++++++++++++
216 - configure.ac | 10 +-
217 - jvmfwk/inc/vendorbase.hxx | 2 +
218 - solenv/gbuild/platform/LINUX_RISCV64_GCC.mk | 15 +
219 - 10 files changed, 1845 insertions(+), 2 deletions(-)
220 - create mode 100644 bridges/source/cpp_uno/gcc3_linux_riscv64/call.hxx
221 - create mode 100644 bridges/source/cpp_uno/gcc3_linux_riscv64/call.s
222 - create mode 100644 bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx
223 - create mode 100644 bridges/source/cpp_uno/gcc3_linux_riscv64/except.cxx
224 - create mode 100644 bridges/source/cpp_uno/gcc3_linux_riscv64/share.hxx
225 - create mode 100644 bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx
226 - create mode 100644 solenv/gbuild/platform/LINUX_RISCV64_GCC.mk
227 -
228 -diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
229 -index a76d2b8..ce27a7e 100644
230 ---- a/bridges/Library_cpp_uno.mk
231 -+++ b/bridges/Library_cpp_uno.mk
232 -@@ -120,6 +120,15 @@ bridge_noopt_objects := cpp2uno uno2cpp
233 - bridge_exception_objects := except
234 - endif
235 -
236 -+else ifeq ($(CPUNAME),RISCV64)
237 -+
238 -+ifneq ($(filter LINUX,$(OS)),)
239 -+bridges_SELECTED_BRIDGE := gcc3_linux_riscv64
240 -+bridge_asm_objects := call
241 -+bridge_noopt_objects := cpp2uno uno2cpp
242 -+bridge_exception_objects := except
243 -+endif
244 -+
245 - else ifeq ($(CPUNAME),POWERPC)
246 -
247 - ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD,$(OS)),)
248 -diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/call.hxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/call.hxx
249 -new file mode 100644
250 -index 0000000..dc84d56
251 ---- /dev/null
252 -+++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/call.hxx
253 -@@ -0,0 +1,35 @@
254 -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
255 -+/*
256 -+ * This file is part of the LibreOffice project.
257 -+ *
258 -+ * This Source Code Form is subject to the terms of the Mozilla Public
259 -+ * License, v. 2.0. If a copy of the MPL was not distributed with this
260 -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
261 -+ *
262 -+ * This file incorporates work covered by the following license notice:
263 -+ *
264 -+ * Licensed to the Apache Software Foundation (ASF) under one or more
265 -+ * contributor license agreements. See the NOTICE file distributed
266 -+ * with this work for additional information regarding copyright
267 -+ * ownership. The ASF licenses this file to you under the Apache
268 -+ * License, Version 2.0 (the "License"); you may not use this file
269 -+ * except in compliance with the License. You may obtain a copy of
270 -+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
271 -+ */
272 -+
273 -+#pragma once
274 -+
275 -+#include <sal/config.h>
276 -+
277 -+#include <sal/types.h>
278 -+
279 -+namespace {
280 -+
281 -+ extern "C" typelib_TypeClass cpp_vtable_call(
282 -+ sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
283 -+ void ** gpreg, void ** fpreg, void ** ovrflw,
284 -+ sal_uInt64 * pRegisterReturn /* space for register return */ );
285 -+
286 -+}
287 -+
288 -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
289 -diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/call.s b/bridges/source/cpp_uno/gcc3_linux_riscv64/call.s
290 -new file mode 100644
291 -index 0000000..2bddfc1
292 ---- /dev/null
293 -+++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/call.s
294 -@@ -0,0 +1,72 @@
295 -+/*
296 -+ * This file is part of the LibreOffice project.
297 -+ *
298 -+ * This Source Code Form is subject to the terms of the Mozilla Public
299 -+ * License, v. 2.0. If a copy of the MPL was not distributed with this
300 -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
301 -+ *
302 -+ * This file incorporates work covered by the following license notice:
303 -+ *
304 -+ * Licensed to the Apache Software Foundation (ASF) under one or more
305 -+ * contributor license agreements. See the NOTICE file distributed
306 -+ * with this work for additional information regarding copyright
307 -+ * ownership. The ASF licenses this file to you under the Apache
308 -+ * License, Version 2.0 (the "License"); you may not use this file
309 -+ * except in compliance with the License. You may obtain a copy of
310 -+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
311 -+ */
312 -+// https://cgit.freedesktop.org/libreoffice/core/tree/bridges/source/cpp_uno/gcc3_linux_mips64/call.s
313 -+
314 -+ .text
315 -+ .align 2
316 -+ .global privateSnippetExecutor
317 -+ .hidden privateSnippetExecutor
318 -+ .type privateSnippetExecutor, %function
319 -+privateSnippetExecutor:
320 -+ .cfi_startproc
321 -+ addi sp,sp,-160
322 -+ .cfi_def_cfa_offset 160
323 -+ sd ra,152(sp)
324 -+ .cfi_offset 1, -8
325 -+ fsd fa0,80(sp)
326 -+ fsd fa1,88(sp)
327 -+ fsd fa2,96(sp)
328 -+ fsd fa3,104(sp)
329 -+ fsd fa4,112(sp)
330 -+ fsd fa5,120(sp)
331 -+ fsd fa6,128(sp)
332 -+ fsd fa7,136(sp)
333 -+ sd a0,16(sp)
334 -+ sd a1,24(sp)
335 -+ sd a2,32(sp)
336 -+ sd a3,40(sp)
337 -+ sd a4,48(sp)
338 -+ sd a5,56(sp)
339 -+ sd a6,64(sp)
340 -+ sd a7,72(sp)
341 -+ // a0 = functionIndex
342 -+ // a1 = vtableOffset
343 -+ // a2 = gpreg
344 -+ // a3 = fpreg
345 -+ // a4 = overflw
346 -+ // a5 = pRegisterReturn
347 -+ add a0,t4,zero
348 -+ add a1,t5,zero
349 -+ addi a2,sp,16
350 -+ addi a3,sp,80
351 -+ addi a4,sp,160
352 -+ add a5,sp,zero
353 -+ // jump to cpp_vtable_call
354 -+ jalr ra,t6,0
355 -+ ld a0,0(sp)
356 -+ ld a1,8(sp)
357 -+ fld fa0,0(sp)
358 -+ fld fa1,8(sp)
359 -+ ld ra,152(sp)
360 -+ .cfi_restore 1
361 -+ addi sp,sp,160
362 -+ .cfi_def_cfa_offset 0
363 -+ jalr zero,ra,0
364 -+ .cfi_endproc
365 -+ .size privateSnippetExecutor, .-privateSnippetExecutor
366 -+ .section .note.GNU-stack, "", @progbits
367 -\ No newline at end of file
368 -diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx
369 -new file mode 100644
370 -index 0000000..4ee41ab
371 ---- /dev/null
372 -+++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/cpp2uno.cxx
373 -@@ -0,0 +1,723 @@
374 -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
375 -+/*
376 -+ * This file is part of the LibreOffice project.
377 -+ *
378 -+ * This Source Code Form is subject to the terms of the Mozilla Public
379 -+ * License, v. 2.0. If a copy of the MPL was not distributed with this
380 -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
381 -+ *
382 -+ * This file incorporates work covered by the following license notice:
383 -+ *
384 -+ * Licensed to the Apache Software Foundation (ASF) under one or more
385 -+ * contributor license agreements. See the NOTICE file distributed
386 -+ * with this work for additional information regarding copyright
387 -+ * ownership. The ASF licenses this file to you under the Apache
388 -+ * License, Version 2.0 (the "License"); you may not use this file
389 -+ * except in compliance with the License. You may obtain a copy of
390 -+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
391 -+ */
392 -+#include <com/sun/star/uno/genfunc.hxx>
393 -+#include <sal/log.hxx>
394 -+#include <typelib/typedescription.hxx>
395 -+#include <uno/data.h>
396 -+#include <osl/endian.h>
397 -+#include "bridge.hxx"
398 -+#include "cppinterfaceproxy.hxx"
399 -+#include "types.hxx"
400 -+#include "vtablefactory.hxx"
401 -+#include "call.hxx"
402 -+#include "share.hxx"
403 -+
404 -+#include <stdio.h>
405 -+#include <string.h>
406 -+
407 -+using namespace com::sun::star::uno;
408 -+
409 -+//#define BRDEBUG
410 -+
411 -+#ifdef BRDEBUG
412 -+#include <rtl/strbuf.hxx>
413 -+#include <rtl/ustrbuf.hxx>
414 -+using namespace ::std;
415 -+using namespace ::osl;
416 -+using namespace ::rtl;
417 -+#endif
418 -+
419 -+namespace CPPU_CURRENT_NAMESPACE
420 -+{
421 -+ bool is_complex_struct(const typelib_TypeDescription * type)
422 -+ {
423 -+ const typelib_CompoundTypeDescription * p
424 -+ = reinterpret_cast< const typelib_CompoundTypeDescription * >(type);
425 -+ for (sal_Int32 i = 0; i < p->nMembers; ++i)
426 -+ {
427 -+ if (p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_STRUCT ||
428 -+ p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_EXCEPTION)
429 -+ {
430 -+ typelib_TypeDescription * t = 0;
431 -+ TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
432 -+ bool b = is_complex_struct(t);
433 -+ TYPELIB_DANGER_RELEASE(t);
434 -+ if (b) {
435 -+ return true;
436 -+ }
437 -+ }
438 -+ else if (!bridges::cpp_uno::shared::isSimpleType(p->ppTypeRefs[i]->eTypeClass))
439 -+ return true;
440 -+ }
441 -+ if (p->pBaseTypeDescription != 0)
442 -+ return is_complex_struct(&p->pBaseTypeDescription->aBase);
443 -+ return false;
444 -+ }
445 -+
446 -+ bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef )
447 -+ {
448 -+ if (bridges::cpp_uno::shared::isSimpleType(pTypeRef))
449 -+ return false;
450 -+ else if (pTypeRef->eTypeClass == typelib_TypeClass_STRUCT ||
451 -+ pTypeRef->eTypeClass == typelib_TypeClass_EXCEPTION)
452 -+ {
453 -+ typelib_TypeDescription * pTypeDescr = 0;
454 -+ TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
455 -+
456 -+ //A Composite Type not larger than 16 bytes is returned in up to two GPRs
457 -+ bool bRet = pTypeDescr->nSize > 16 || is_complex_struct(pTypeDescr);
458 -+
459 -+ TYPELIB_DANGER_RELEASE( pTypeDescr );
460 -+ return bRet;
461 -+ }
462 -+ return true;
463 -+ }
464 -+}
465 -+
466 -+namespace
467 -+{
468 -+
469 -+ static typelib_TypeClass cpp2uno_call(
470 -+ bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
471 -+ const typelib_TypeDescription * pMemberTypeDescr,
472 -+ typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
473 -+ sal_Int32 nParams, typelib_MethodParameter * pParams,
474 -+ void ** gpreg, void ** fpreg, void ** ovrflw,
475 -+ sal_uInt64 * pRegisterReturn /* space for register return */ )
476 -+ {
477 -+ /* Most MIPS ABIs view the arguments as a struct, of which the
478 -+ first N words go in registers and the rest go on the stack. If I < N, the
479 -+ With word might go in With integer argument register or the With
480 -+ floating-point one. For these ABIs, we only need to remember the number
481 -+ of words passed so far. We are interested only in n64 ABI,so it is the
482 -+ case.
483 -+ */
484 -+ unsigned int nREG = 0;
485 -+
486 -+#ifdef BRDEBUG
487 -+ fprintf(stdout, "cpp2uno_call:begin\n");
488 -+#endif
489 -+ // return
490 -+ typelib_TypeDescription * pReturnTypeDescr = 0;
491 -+ if (pReturnTypeRef)
492 -+ TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
493 -+
494 -+ void * pUnoReturn = 0;
495 -+ void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
496 -+
497 -+ if (pReturnTypeDescr)
498 -+ {
499 -+ if (CPPU_CURRENT_NAMESPACE::return_in_hidden_param( pReturnTypeRef ) )
500 -+ {
501 -+ pCppReturn = gpreg[nREG]; // complex return via ptr (pCppReturn)
502 -+ nREG++;
503 -+
504 -+ pUnoReturn = ( bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
505 -+ ? alloca( pReturnTypeDescr->nSize )
506 -+ : pCppReturn); // direct way
507 -+#ifdef BRDEBUG
508 -+ fprintf(stdout, "cpp2uno_call:complexreturn\n");
509 -+#endif
510 -+ }
511 -+ else
512 -+ {
513 -+ pUnoReturn = pRegisterReturn; // direct way for simple types
514 -+#ifdef BRDEBUG
515 -+ fprintf(stdout, "cpp2uno_call:simplereturn\n");
516 -+#endif
517 -+ }
518 -+ }
519 -+
520 -+ // pop this
521 -+ nREG++;
522 -+
523 -+ // stack space
524 -+ static_assert(sizeof(void *) == sizeof(sal_Int64), "### unexpected size!");
525 -+ // parameters
526 -+ void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
527 -+ void ** pCppArgs = pUnoArgs + nParams;
528 -+ // indices of values this have to be converted (interface conversion cpp<=>uno)
529 -+ sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
530 -+ // type descriptions for reconversions
531 -+ typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
532 -+
533 -+ sal_Int32 nTempIndices = 0;
534 -+
535 -+#ifdef BRDEBUG
536 -+ fprintf(stdout, "cpp2uno_call:nParams=%d\n", nParams);
537 -+#endif
538 -+ for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
539 -+ {
540 -+ const typelib_MethodParameter & rParam = pParams[nPos];
541 -+
542 -+ typelib_TypeDescription * pParamTypeDescr = 0;
543 -+ TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
544 -+
545 -+ if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
546 -+ {
547 -+#ifdef BRDEBUG
548 -+ fprintf(stdout, "cpp2uno_call:Param %u, type %u\n", nPos, pParamTypeDescr->eTypeClass);
549 -+#endif
550 -+ switch (pParamTypeDescr->eTypeClass)
551 -+ {
552 -+ case typelib_TypeClass_FLOAT:
553 -+ case typelib_TypeClass_DOUBLE:
554 -+ if (nREG < MAX_FP_REGS) {
555 -+#ifdef BRDEBUG
556 -+ fprintf(stdout, "cpp2uno_call:fpr=%p\n", fpreg[nREG]);
557 -+#endif
558 -+ pCppArgs[nPos] = &(fpreg[nREG]);
559 -+ pUnoArgs[nPos] = &(fpreg[nREG]);
560 -+ } else {
561 -+#ifdef BRDEBUG
562 -+ fprintf(stdout, "cpp2uno_call:fpr=%p\n", ovrflw[nREG - MAX_FP_REGS]);
563 -+#endif
564 -+ pCppArgs[nPos] = &(ovrflw[nREG - MAX_FP_REGS]);
565 -+ pUnoArgs[nPos] = &(ovrflw[nREG - MAX_FP_REGS]);
566 -+ }
567 -+ nREG++;
568 -+ break;
569 -+
570 -+
571 -+ default:
572 -+ if (nREG < MAX_GP_REGS) {
573 -+#ifdef BRDEBUG
574 -+ fprintf(stdout, "cpp2uno_call:gpr=%p\n", gpreg[nREG]);
575 -+#endif
576 -+ pCppArgs[nPos] = &(gpreg[nREG]);
577 -+ pUnoArgs[nPos] = &(gpreg[nREG]);
578 -+ } else {
579 -+#ifdef BRDEBUG
580 -+ fprintf(stdout, "cpp2uno_call:gpr=%p\n", ovrflw[nREG - MAX_GP_REGS]);
581 -+#endif
582 -+ pCppArgs[nPos] = &(ovrflw[nREG - MAX_GP_REGS]);
583 -+ pUnoArgs[nPos] = &(ovrflw[nREG - MAX_GP_REGS]);
584 -+ }
585 -+ nREG++;
586 -+ break;
587 -+
588 -+ }
589 -+ // no longer needed
590 -+ TYPELIB_DANGER_RELEASE( pParamTypeDescr );
591 -+ }
592 -+ else // ptr to complex value | ref
593 -+ {
594 -+#ifdef BRDEBUG
595 -+ fprintf(stdout,"cpp2uno_call:ptr|ref\n");
596 -+#endif
597 -+ void *pCppStack;
598 -+ if (nREG < MAX_GP_REGS) {
599 -+ pCppArgs[nPos] = pCppStack = gpreg[nREG];
600 -+ } else {
601 -+ pCppArgs[nPos] = pCppStack = ovrflw[nREG - MAX_GP_REGS];
602 -+ }
603 -+ nREG++;
604 -+#ifdef BRDEBUG
605 -+ fprintf(stdout, "cpp2uno_call:pCppStack=%p\n", pCppStack);
606 -+#endif
607 -+
608 -+ if (! rParam.bIn) // is pure out
609 -+ {
610 -+ // uno out is unconstructed mem!
611 -+ pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
612 -+ pTempIndices[nTempIndices] = nPos;
613 -+ // will be released at reconversion
614 -+ ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
615 -+ }
616 -+ // is in/inout
617 -+ else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
618 -+ {
619 -+ uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
620 -+ pCppStack, pParamTypeDescr,
621 -+ pThis->getBridge()->getCpp2Uno() );
622 -+ pTempIndices[nTempIndices] = nPos; // has to be reconverted
623 -+ // will be released at reconversion
624 -+ ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
625 -+#ifdef BRDEBUG
626 -+ fprintf(stdout, "cpp2uno_call:related to interface,%p,%d,pUnoargs[%d]=%p\n",
627 -+ pCppStack, pParamTypeDescr->nSize, nPos, pUnoArgs[nPos]);
628 -+#endif
629 -+ }
630 -+ else // direct way
631 -+ {
632 -+ pUnoArgs[nPos] = pCppStack;
633 -+#ifdef BRDEBUG
634 -+ fprintf(stdout, "cpp2uno_call:direct,pUnoArgs[%d]=%p\n", nPos, pUnoArgs[nPos]);
635 -+#endif
636 -+ // no longer needed
637 -+ TYPELIB_DANGER_RELEASE( pParamTypeDescr );
638 -+ }
639 -+ }
640 -+ }
641 -+#ifdef BRDEBUG
642 -+ fprintf(stdout, "cpp2uno_call2,%p,unoargs=%p\n", pThis->getUnoI()->pDispatcher, pUnoArgs);
643 -+#endif
644 -+
645 -+ // ExceptionHolder
646 -+ uno_Any aUnoExc; // Any will be constructed by callee
647 -+ uno_Any * pUnoExc = &aUnoExc;
648 -+
649 -+ // invoke uno dispatch call
650 -+ (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
651 -+#ifdef BRDEBUG
652 -+ fprintf(stdout, "cpp2uno_call2,after dispatch\n");
653 -+#endif
654 -+
655 -+ // in case an exception occurred...
656 -+ if (pUnoExc)
657 -+ {
658 -+ fflush(stdout);
659 -+ // destruct temporary in/inout params
660 -+ for ( ; nTempIndices--; )
661 -+ {
662 -+ sal_Int32 nIndex = pTempIndices[nTempIndices];
663 -+
664 -+ if (pParams[nIndex].bIn) // is in/inout => was constructed
665 -+ uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
666 -+ TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
667 -+ }
668 -+ if (pReturnTypeDescr)
669 -+ TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
670 -+
671 -+ CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() );
672 -+ // has to destruct the any
673 -+ // is here for dummy
674 -+ return typelib_TypeClass_VOID;
675 -+ }
676 -+ else // else no exception occurred...
677 -+ {
678 -+ // temporary params
679 -+ for ( ; nTempIndices--; )
680 -+ {
681 -+ sal_Int32 nIndex = pTempIndices[nTempIndices];
682 -+ typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
683 -+
684 -+ if (pParams[nIndex].bOut) // inout/out
685 -+ {
686 -+ // convert and assign
687 -+ uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
688 -+ uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
689 -+ pThis->getBridge()->getUno2Cpp() );
690 -+ }
691 -+ // destroy temp uno param
692 -+ uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
693 -+
694 -+ TYPELIB_DANGER_RELEASE( pParamTypeDescr );
695 -+ }
696 -+ // return
697 -+ if (pCppReturn) // has complex return
698 -+ {
699 -+ if (pUnoReturn != pCppReturn) // needs reconversion
700 -+ {
701 -+ uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
702 -+ pThis->getBridge()->getUno2Cpp() );
703 -+ // destroy temp uno return
704 -+ uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
705 -+ }
706 -+ // complex return ptr is set to return reg
707 -+ *(void **)pRegisterReturn = pCppReturn;
708 -+ }
709 -+ if (pReturnTypeDescr)
710 -+ {
711 -+ typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
712 -+ TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
713 -+ return eRet;
714 -+ }
715 -+ else
716 -+ return typelib_TypeClass_VOID;
717 -+ }
718 -+ }
719 -+
720 -+
721 -+ /**
722 -+ * is called on incoming vtable calls
723 -+ * (called by asm snippets)
724 -+ */
725 -+ typelib_TypeClass cpp_vtable_call(
726 -+ sal_Int32 nFunctionIndex,
727 -+ sal_Int32 nVtableOffset,
728 -+ void ** gpreg, void ** fpreg, void ** ovrflw,
729 -+ sal_uInt64 * pRegisterReturn /* space for register return */ )
730 -+ {
731 -+ static_assert( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" );
732 -+
733 -+#ifdef BRDEBUG
734 -+ fprintf(stdout, "in cpp_vtable_call nFunctionIndex is %d\n", nFunctionIndex);
735 -+ fprintf(stdout, "in cpp_vtable_call nVtableOffset is %d\n", nVtableOffset);
736 -+ fprintf(stdout, "in cpp_vtable_call gp=%p, fp=%p, ov=%p\n", gpreg, fpreg, ovrflw);
737 -+#endif
738 -+
739 -+ // gpreg: [ret *], this, [other gpr params]
740 -+ // fpreg: [fpr params]
741 -+ // ovrflw: [gpr or fpr params (properly aligned)]
742 -+ void * pThis;
743 -+ if (nFunctionIndex & 0x80000000 )
744 -+ {
745 -+ nFunctionIndex &= 0x7fffffff;
746 -+ pThis = gpreg[1];
747 -+ }
748 -+ else
749 -+ {
750 -+ pThis = gpreg[0];
751 -+ }
752 -+#ifdef BRDEBUG
753 -+ fprintf(stdout, "cpp_vtable_call, pThis=%p, nFunctionIndex=%d, nVtableOffset=%d\n",
754 -+ pThis, nFunctionIndex, nVtableOffset);
755 -+#endif
756 -+
757 -+ pThis = static_cast< char * >(pThis) - nVtableOffset;
758 -+ bridges::cpp_uno::shared::CppInterfaceProxy * pCppI =
759 -+ bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy( pThis );
760 -+#ifdef BRDEBUG
761 -+ fprintf(stdout, "cpp_vtable_call, pCppI=%p\n", pCppI);
762 -+#endif
763 -+
764 -+ typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
765 -+
766 -+ if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
767 -+ {
768 -+ SAL_WARN(
769 -+ "bridges",
770 -+ "illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
771 -+ << " vtable index " << nFunctionIndex << "/"
772 -+ << pTypeDescr->nMapFunctionIndexToMemberIndex);
773 -+ throw RuntimeException(
774 -+ ("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
775 -+ + " vtable index " + OUString::number(nFunctionIndex) + "/"
776 -+ + OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
777 -+ (XInterface *)pThis);
778 -+ }
779 -+
780 -+ // determine called method
781 -+ sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
782 -+ assert(nMemberPos < pTypeDescr->nAllMembers);
783 -+
784 -+ TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
785 -+
786 -+#ifdef BRDEBUG
787 -+ //OString cstr( OUStringToOString( aMemberDescr.get()->pTypeName, RTL_TEXTENCODING_ASCII_US ) );
788 -+ //fprintf(stdout, "calling %s, nFunctionIndex=%d\n", cstr.getStr(), nFunctionIndex );
789 -+#endif
790 -+ typelib_TypeClass eRet;
791 -+ switch (aMemberDescr.get()->eTypeClass)
792 -+ {
793 -+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
794 -+ {
795 -+#ifdef BRDEBUG
796 -+ fprintf(stdout, "cpp_vtable_call interface attribute\n");
797 -+#endif
798 -+ typelib_TypeDescriptionReference *pAttrTypeRef =
799 -+ reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( aMemberDescr.get() )->pAttributeTypeRef;
800 -+
801 -+ if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
802 -+ {
803 -+ // is GET method
804 -+ eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef,
805 -+ 0, 0, // no params
806 -+ gpreg, fpreg, ovrflw, pRegisterReturn );
807 -+ }
808 -+ else
809 -+ {
810 -+ // is SET method
811 -+ typelib_MethodParameter aParam;
812 -+ aParam.pTypeRef = pAttrTypeRef;
813 -+ aParam.bIn = sal_True;
814 -+ aParam.bOut = sal_False;
815 -+
816 -+ eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
817 -+ 0, // indicates void return
818 -+ 1, &aParam,
819 -+ gpreg, fpreg, ovrflw, pRegisterReturn );
820 -+ }
821 -+ break;
822 -+ }
823 -+ case typelib_TypeClass_INTERFACE_METHOD:
824 -+ {
825 -+#ifdef BRDEBUG
826 -+ fprintf(stdout, "cpp_vtable_call interface method\n");
827 -+#endif
828 -+ // is METHOD
829 -+ switch (nFunctionIndex)
830 -+ {
831 -+ case 1: // acquire()
832 -+#ifdef BRDEBUG
833 -+ fprintf(stdout, "cpp_vtable_call method acquire\n");
834 -+#endif
835 -+ pCppI->acquireProxy(); // non virtual call!
836 -+ eRet = typelib_TypeClass_VOID;
837 -+ break;
838 -+ case 2: // release()
839 -+#ifdef BRDEBUG
840 -+ fprintf(stdout, "cpp_vtable_call method release\n");
841 -+#endif
842 -+ pCppI->releaseProxy(); // non virtual call!
843 -+ eRet = typelib_TypeClass_VOID;
844 -+ break;
845 -+ case 0: // queryInterface() opt
846 -+ {
847 -+#ifdef BRDEBUG
848 -+ fprintf(stdout, "cpp_vtable_call method query interface opt\n");
849 -+#endif
850 -+ typelib_TypeDescription * pTD = 0;
851 -+ TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
852 -+ if (pTD)
853 -+ {
854 -+ XInterface * pInterface = 0;
855 -+ (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
856 -+ ( pCppI->getBridge()->getCppEnv(),
857 -+ (void **)&pInterface,
858 -+ pCppI->getOid().pData,
859 -+ reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD ) );
860 -+
861 -+ if (pInterface)
862 -+ {
863 -+ ::uno_any_construct( reinterpret_cast< uno_Any * >( gpreg[0] ),
864 -+ &pInterface, pTD, cpp_acquire );
865 -+
866 -+ pInterface->release();
867 -+ TYPELIB_DANGER_RELEASE( pTD );
868 -+
869 -+ reinterpret_cast<void **>( pRegisterReturn )[0] = gpreg[0];
870 -+ eRet = typelib_TypeClass_ANY;
871 -+ break;
872 -+ }
873 -+ TYPELIB_DANGER_RELEASE( pTD );
874 -+ }
875 -+ } // else perform queryInterface()
876 -+ default:
877 -+#ifdef BRDEBUG
878 -+ fprintf(stdout, "cpp_vtable_call method query interface\n");
879 -+#endif
880 -+ typelib_InterfaceMethodTypeDescription *pMethodTD =
881 -+ reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( aMemberDescr.get() );
882 -+
883 -+ eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
884 -+ pMethodTD->pReturnTypeRef,
885 -+ pMethodTD->nParams,
886 -+ pMethodTD->pParams,
887 -+ gpreg, fpreg, ovrflw, pRegisterReturn );
888 -+ }
889 -+ break;
890 -+ }
891 -+ default:
892 -+ {
893 -+#ifdef BRDEBUG
894 -+ fprintf(stdout, "cpp_vtable_call no member\n");
895 -+#endif
896 -+ throw RuntimeException( "no member description found!", (XInterface *)pThis );
897 -+ }
898 -+ }
899 -+
900 -+ return eRet;
901 -+ }
902 -+
903 -+ extern "C" void privateSnippetExecutor( ... );
904 -+
905 -+ int const codeSnippetSize = 0x6c;
906 -+
907 -+ unsigned char * codeSnippet( unsigned char * code,
908 -+ sal_Int32 functionIndex, sal_Int32 vtableOffset,
909 -+ bool bHasHiddenParam )
910 -+ {
911 -+#ifdef BRDEBUG
912 -+ fprintf(stdout,"in codeSnippet functionIndex is %d\n", functionIndex);
913 -+ fprintf(stdout,"in codeSnippet vtableOffset is %d\n", vtableOffset);
914 -+ fprintf(stdout,"in codeSnippet privateSnippetExecutor is %lx\n", (unsigned long)privateSnippetExecutor);
915 -+ fprintf(stdout,"in codeSnippet cpp_vtable_call is %lx\n", (unsigned long)cpp_vtable_call);
916 -+
917 -+ fflush(stdout);
918 -+#endif
919 -+
920 -+ if ( bHasHiddenParam )
921 -+ functionIndex |= 0x80000000;
922 -+
923 -+ unsigned int * p = (unsigned int *) code;
924 -+
925 -+ assert((((unsigned long)code) & 0x3) == 0 ); //aligned to 4 otherwise a mistake
926 -+
927 -+ /* generate this code */
928 -+ /*
929 -+ # load functionIndex to t4
930 -+ 00000eb7 lui t4,0x0
931 -+ 000eee93 ori t4,t4,0x0
932 -+ # load privateSnippetExecutor to t0
933 -+ 000002b7 lui t0,0x0
934 -+ 02429293 slli t0,t0,36
935 -+ 00000337 lui t1,0x0
936 -+ 01431313 slli t1,t1,20
937 -+ 0062e2b3 or t0,t0,t1
938 -+ 00000337 lui t1,0x0
939 -+ 00431313 slli t1,t1,4
940 -+ 0062e2b3 or t0,t0,t1
941 -+ 00000337 lui t1,0x0
942 -+ 00c35313 srli t1,t1,12
943 -+ 0062e2b3 or t0,t0,t1
944 -+ # load cpp_vtable_call to t6
945 -+ 00000fb7 lui t6,0x0
946 -+ 024f9f93 slli t6,t6,36
947 -+ 00000337 lui t1,0x0
948 -+ 01431313 slli t1,t1,20
949 -+ 006fefb3 or t6,t6,t1
950 -+ 00000337 lui t1,0x0
951 -+ 00431313 slli t1,t1,4
952 -+ 006fefb3 or t6,t6,t1
953 -+ 00000337 lui t1,0x0
954 -+ 00c35313 srli t1,t1,12
955 -+ 006fefb3 or t6,t6,t1
956 -+ # load vtableOffset to t5
957 -+ 00000f37 lui t5,0x0
958 -+ 000f6f13 ori t5,t5,0x0
959 -+ # jump to privateSnippetExecutor
960 -+ 00028067 jalr zero,t0,0x0
961 -+ */
962 -+
963 -+ * p++ = 0x00000eb7 | ((functionIndex) & 0xfffff000);
964 -+ * p++ = 0x000eee93 | ((functionIndex << 20 ) & 0xfff00000);
965 -+
966 -+ // load privateSnippetExecutor to t0
967 -+ unsigned long functionEntry = ((unsigned long)privateSnippetExecutor);
968 -+ * p++ = 0x000002b7 | ((functionEntry >> 36) & 0x000000000ffff000);
969 -+ * p++ = 0x02429293;
970 -+ * p++ = 0x00000337 | ((functionEntry >> 20) & 0x000000000ffff000);
971 -+ * p++ = 0x01431313;
972 -+ * p++ = 0x0062e2b3;
973 -+ * p++ = 0x00000337 | ((functionEntry >> 4) & 0x000000000ffff000);
974 -+ * p++ = 0x00431313;
975 -+ * p++ = 0x0062e2b3;
976 -+ * p++ = 0x00000337 | ((functionEntry << 12) & 0x000000000ffff000);
977 -+ * p++ = 0x00c35313;
978 -+ * p++ = 0x0062e2b3;
979 -+ // load cpp_vtable_call to t6
980 -+ functionEntry = (unsigned long) cpp_vtable_call;
981 -+ * p++ = 0x00000fb7 | ((functionEntry >> 36) & 0x000000000ffff000);
982 -+ * p++ = 0x024f9f93;
983 -+ * p++ = 0x00000337 | ((functionEntry >> 20) & 0x000000000ffff000);
984 -+ * p++ = 0x01431313;
985 -+ * p++ = 0x006fefb3;
986 -+ * p++ = 0x00000337 | ((functionEntry >> 4) & 0x000000000ffff000);
987 -+ * p++ = 0x00431313;
988 -+ * p++ = 0x006fefb3;
989 -+ * p++ = 0x00000337 | ((functionEntry << 12) & 0x000000000ffff000);
990 -+ * p++ = 0x00c35313;
991 -+ * p++ = 0x006fefb3;
992 -+ // load vtableOffset to t5
993 -+ * p++ = 0x00000f37 | ((vtableOffset) & 0xfffff000);
994 -+ * p++ = 0x000f6f13 | ((vtableOffset << 20 ) & 0xfff00000);
995 -+ // jump to privateSnippetExecutor
996 -+ * p++ = 0x00028067;
997 -+ return (code + codeSnippetSize);
998 -+
999 -+ }
1000 -+
1001 -+}
1002 -+
1003 -+
1004 -+void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *bptr, unsigned char const *eptr)
1005 -+{
1006 -+ asm volatile(
1007 -+ "fence":::
1008 -+ );
1009 -+}
1010 -+
1011 -+struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
1012 -+
1013 -+bridges::cpp_uno::shared::VtableFactory::Slot *
1014 -+bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
1015 -+{
1016 -+ return static_cast< Slot * >(block) + 2;
1017 -+}
1018 -+
1019 -+
1020 -+std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
1021 -+ sal_Int32 slotCount)
1022 -+{
1023 -+ return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
1024 -+}
1025 -+
1026 -+bridges::cpp_uno::shared::VtableFactory::Slot *
1027 -+bridges::cpp_uno::shared::VtableFactory::initializeBlock(
1028 -+ void * block, sal_Int32 slotCount, sal_Int32,
1029 -+ typelib_InterfaceTypeDescription *)
1030 -+{
1031 -+ Slot * slots = mapBlockToVtable(block);
1032 -+ slots[-2].fn = 0; //null
1033 -+ slots[-1].fn = 0; //destructor
1034 -+ return slots + slotCount;
1035 -+}
1036 -+
1037 -+unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
1038 -+ Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
1039 -+ typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
1040 -+ sal_Int32 functionCount, sal_Int32 vtableOffset)
1041 -+{
1042 -+ (*slots) -= functionCount;
1043 -+ Slot * s = *slots;
1044 -+
1045 -+#ifdef BRDEBUG
1046 -+ fprintf(stdout, "in addLocalFunctions functionOffset is %d\n", functionOffset);
1047 -+ fprintf(stdout, "in addLocalFunctions vtableOffset is %d\n", vtableOffset);
1048 -+ fprintf(stdout, "nMembers=%d\n", type->nMembers);
1049 -+ fflush(stdout);
1050 -+#endif
1051 -+
1052 -+ for (sal_Int32 i = 0; i < type->nMembers; ++i) {
1053 -+ typelib_TypeDescription * member = 0;
1054 -+ TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
1055 -+ assert(member != 0);
1056 -+ switch (member->eTypeClass) {
1057 -+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
1058 -+ // Getter:
1059 -+ (s++)->fn = code + writetoexecdiff;
1060 -+ code = codeSnippet(
1061 -+ code, functionOffset++, vtableOffset,
1062 -+ CPPU_CURRENT_NAMESPACE::return_in_hidden_param(
1063 -+ reinterpret_cast<
1064 -+ typelib_InterfaceAttributeTypeDescription * >(
1065 -+ member)->pAttributeTypeRef));
1066 -+
1067 -+ // Setter:
1068 -+ if (!reinterpret_cast<
1069 -+ typelib_InterfaceAttributeTypeDescription * >(
1070 -+ member)->bReadOnly)
1071 -+ {
1072 -+ (s++)->fn = code + writetoexecdiff;
1073 -+ code = codeSnippet(code, functionOffset++, vtableOffset, false);
1074 -+ }
1075 -+ break;
1076 -+
1077 -+ case typelib_TypeClass_INTERFACE_METHOD:
1078 -+ (s++)->fn = code + writetoexecdiff;
1079 -+ code = codeSnippet(
1080 -+ code, functionOffset++, vtableOffset,
1081 -+ CPPU_CURRENT_NAMESPACE::return_in_hidden_param(
1082 -+ reinterpret_cast<
1083 -+ typelib_InterfaceMethodTypeDescription * >(
1084 -+ member)->pReturnTypeRef));
1085 -+ break;
1086 -+
1087 -+ default:
1088 -+ assert(false);
1089 -+ break;
1090 -+ }
1091 -+ TYPELIB_DANGER_RELEASE(member);
1092 -+ }
1093 -+ return code;
1094 -+}
1095 -+
1096 -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1097 -diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/except.cxx
1098 -new file mode 100644
1099 -index 0000000..e37e5d8
1100 ---- /dev/null
1101 -+++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/except.cxx
1102 -@@ -0,0 +1,297 @@
1103 -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
1104 -+/*
1105 -+ * This file is part of the LibreOffice project.
1106 -+ *
1107 -+ * This Source Code Form is subject to the terms of the Mozilla Public
1108 -+ * License, v. 2.0. If a copy of the MPL was not distributed with this
1109 -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
1110 -+ *
1111 -+ * This file incorporates work covered by the following license notice:
1112 -+ *
1113 -+ * Licensed to the Apache Software Foundation (ASF) under one or more
1114 -+ * contributor license agreements. See the NOTICE file distributed
1115 -+ * with this work for additional information regarding copyright
1116 -+ * ownership. The ASF licenses this file to you under the Apache
1117 -+ * License, Version 2.0 (the "License"); you may not use this file
1118 -+ * except in compliance with the License. You may obtain a copy of
1119 -+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
1120 -+ */
1121 -+#include <stdio.h>
1122 -+#include <string.h>
1123 -+#include <dlfcn.h>
1124 -+#include <cxxabi.h>
1125 -+#include <rtl/strbuf.hxx>
1126 -+#include <rtl/ustrbuf.hxx>
1127 -+#include <sal/log.hxx>
1128 -+#include <osl/mutex.hxx>
1129 -+
1130 -+#include <com/sun/star/uno/genfunc.hxx>
1131 -+#include <typelib/typedescription.hxx>
1132 -+#include <uno/any2.h>
1133 -+
1134 -+#include <unordered_map>
1135 -+#include "share.hxx"
1136 -+
1137 -+using namespace ::std;
1138 -+using namespace ::osl;
1139 -+using namespace ::com::sun::star::uno;
1140 -+using namespace ::__cxxabiv1;
1141 -+
1142 -+//#define BRIDGES_DEBUG
1143 -+
1144 -+namespace CPPU_CURRENT_NAMESPACE
1145 -+{
1146 -+
1147 -+void dummy_can_throw_anything( char const * )
1148 -+{
1149 -+}
1150 -+
1151 -+static OUString toUNOname( char const * p )
1152 -+{
1153 -+#if defined BRIDGES_DEBUG
1154 -+ char const * start = p;
1155 -+#endif
1156 -+
1157 -+ // example: N3com3sun4star4lang24IllegalArgumentExceptionE
1158 -+
1159 -+ OUStringBuffer buf( 64 );
1160 -+ assert( 'N' == *p );
1161 -+ ++p; // skip N
1162 -+
1163 -+ while ('E' != *p)
1164 -+ {
1165 -+ // read chars count
1166 -+ long n = (*p++ - '0');
1167 -+ while ('0' <= *p && '9' >= *p)
1168 -+ {
1169 -+ n *= 10;
1170 -+ n += (*p++ - '0');
1171 -+ }
1172 -+ buf.appendAscii( p, n );
1173 -+ p += n;
1174 -+ if ('E' != *p)
1175 -+ buf.append( '.' );
1176 -+ }
1177 -+
1178 -+#if defined BRIDGES_DEBUG
1179 -+ OUString ret( buf.makeStringAndClear() );
1180 -+ OString c_ret( OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US ) );
1181 -+ fprintf( stderr, "> toUNOname(): %s => %s\n", start, c_ret.getStr() );
1182 -+ return ret;
1183 -+#else
1184 -+ return buf.makeStringAndClear();
1185 -+#endif
1186 -+}
1187 -+
1188 -+class RTTI
1189 -+{
1190 -+ typedef std::unordered_map< OUString, type_info * > t_rtti_map;
1191 -+
1192 -+ Mutex m_mutex;
1193 -+ t_rtti_map m_rttis;
1194 -+ t_rtti_map m_generatedRttis;
1195 -+
1196 -+ void * m_hApp;
1197 -+
1198 -+public:
1199 -+ RTTI();
1200 -+ ~RTTI();
1201 -+
1202 -+ type_info * getRTTI( typelib_CompoundTypeDescription * );
1203 -+};
1204 -+
1205 -+RTTI::RTTI()
1206 -+ : m_hApp( dlopen( 0, RTLD_LAZY ) )
1207 -+{
1208 -+}
1209 -+
1210 -+RTTI::~RTTI()
1211 -+{
1212 -+ dlclose( m_hApp );
1213 -+}
1214 -+
1215 -+
1216 -+type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
1217 -+{
1218 -+ type_info * rtti;
1219 -+
1220 -+ OUString const & unoName = *(OUString const *)&pTypeDescr->aBase.pTypeName;
1221 -+
1222 -+ MutexGuard guard( m_mutex );
1223 -+ t_rtti_map::const_iterator iRttiFind( m_rttis.find( unoName ) );
1224 -+ if (iRttiFind == m_rttis.end())
1225 -+ {
1226 -+ // RTTI symbol
1227 -+ OStringBuffer buf( 64 );
1228 -+ buf.append( "_ZTIN" );
1229 -+ sal_Int32 index = 0;
1230 -+ do
1231 -+ {
1232 -+ OUString token( unoName.getToken( 0, '.', index ) );
1233 -+ buf.append( token.getLength() );
1234 -+ OString c_token( OUStringToOString( token, RTL_TEXTENCODING_ASCII_US ) );
1235 -+ buf.append( c_token );
1236 -+ }
1237 -+ while (index >= 0);
1238 -+ buf.append( 'E' );
1239 -+
1240 -+ OString symName( buf.makeStringAndClear() );
1241 -+ rtti = (type_info *)dlsym( m_hApp, symName.getStr() );
1242 -+
1243 -+ if (rtti)
1244 -+ {
1245 -+ pair< t_rtti_map::iterator, bool > insertion(
1246 -+ m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
1247 -+ assert(insertion.second && "### inserting new rtti failed?!");
1248 -+ }
1249 -+ else
1250 -+ {
1251 -+ // try to lookup the symbol in the generated rtti map
1252 -+ t_rtti_map::const_iterator iFind( m_generatedRttis.find( unoName ) );
1253 -+ if (iFind == m_generatedRttis.end())
1254 -+ {
1255 -+ // we must generate it !
1256 -+ // symbol and rtti-name is nearly identical,
1257 -+ // the symbol is prefixed with _ZTI
1258 -+ char const * rttiName = symName.getStr() +4;
1259 -+#if defined BRIDGES_DEBUG
1260 -+ fprintf( stderr,"generated rtti for %s\n", rttiName );
1261 -+#endif
1262 -+ if (pTypeDescr->pBaseTypeDescription)
1263 -+ {
1264 -+ // ensure availability of base
1265 -+ type_info * base_rtti = getRTTI(
1266 -+ (typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription );
1267 -+ rtti = new __si_class_type_info(
1268 -+ strdup( rttiName ), (__class_type_info *)base_rtti );
1269 -+ }
1270 -+ else
1271 -+ {
1272 -+ // this class has no base class
1273 -+ rtti = new __class_type_info( strdup( rttiName ) );
1274 -+ }
1275 -+
1276 -+ pair< t_rtti_map::iterator, bool > insertion(
1277 -+ m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
1278 -+ assert(insertion.second && "### inserting new generated rtti failed?!");
1279 -+ }
1280 -+ else // taking already generated rtti
1281 -+ {
1282 -+ rtti = iFind->second;
1283 -+ }
1284 -+ }
1285 -+ }
1286 -+ else
1287 -+ {
1288 -+ rtti = iRttiFind->second;
1289 -+ }
1290 -+
1291 -+ return rtti;
1292 -+}
1293 -+
1294 -+
1295 -+static void deleteException( void * pExc )
1296 -+{
1297 -+ fprintf( stderr, "in deleteException: pExc = %p\n",pExc );
1298 -+ __cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
1299 -+ typelib_TypeDescription * pTD = 0;
1300 -+ OUString unoName( toUNOname( header->exceptionType->name() ) );
1301 -+ ::typelib_typedescription_getByName( &pTD, unoName.pData );
1302 -+ assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
1303 -+ if (pTD)
1304 -+ {
1305 -+ ::uno_destructData( pExc, pTD, cpp_release );
1306 -+ ::typelib_typedescription_release( pTD );
1307 -+ }
1308 -+}
1309 -+
1310 -+
1311 -+
1312 -+//extern "C" {
1313 -+// void __cxa_throw(void* ex, void* info, void (*dest)(void*)) { ::abort(); }
1314 -+//}
1315 -+
1316 -+
1317 -+void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
1318 -+{
1319 -+#if defined BRIDGES_DEBUG
1320 -+ OString cstr(
1321 -+ OUStringToOString(
1322 -+ OUString::unacquired( &pUnoExc->pType->pTypeName ),
1323 -+ RTL_TEXTENCODING_ASCII_US ) );
1324 -+ fprintf( stderr, "> uno exception occurred: %s\n", cstr.getStr() );
1325 -+#endif
1326 -+ void * pCppExc;
1327 -+ type_info * rtti;
1328 -+
1329 -+ {
1330 -+ // construct cpp exception object
1331 -+ typelib_TypeDescription * pTypeDescr = 0;
1332 -+ TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType );
1333 -+ assert(pTypeDescr);
1334 -+ if (! pTypeDescr)
1335 -+ {
1336 -+ throw RuntimeException(
1337 -+ OUString("cannot get typedescription for type ") +
1338 -+ OUString::unacquired( &pUnoExc->pType->pTypeName ) );
1339 -+ }
1340 -+
1341 -+ pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
1342 -+ ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
1343 -+
1344 -+ // destruct uno exception
1345 -+ ::uno_any_destruct( pUnoExc, 0 );
1346 -+ // avoiding locked counts
1347 -+ static RTTI rtti_data;
1348 -+ rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
1349 -+ TYPELIB_DANGER_RELEASE( pTypeDescr );
1350 -+ assert(rtti && "### no rtti for throwing exception!");
1351 -+ if (! rtti)
1352 -+ {
1353 -+ throw RuntimeException(
1354 -+ OUString("no rtti for type ") +
1355 -+ OUString::unacquired( &pUnoExc->pType->pTypeName ) );
1356 -+ }
1357 -+ }
1358 -+ __cxa_throw( pCppExc, rtti, deleteException );
1359 -+}
1360 -+
1361 -+void fillUnoException(uno_Any * pUnoExc, uno_Mapping * pCpp2Uno)
1362 -+{
1363 -+ __cxa_exception * header = __cxa_get_globals()->caughtExceptions;
1364 -+ if (! header)
1365 -+ {
1366 -+ RuntimeException aRE( "no exception header!" );
1367 -+ Type const & rType = cppu::UnoType<decltype(aRE)>::get();
1368 -+ uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
1369 -+ SAL_WARN("bridges", aRE.Message);
1370 -+ return;
1371 -+ }
1372 -+
1373 -+ std::type_info *exceptionType = __cxa_current_exception_type();
1374 -+
1375 -+ typelib_TypeDescription * pExcTypeDescr = 0;
1376 -+ OUString unoName( toUNOname( exceptionType->name() ) );
1377 -+#if defined BRIDGES_DEBUG
1378 -+ OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) );
1379 -+ fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() );
1380 -+#endif
1381 -+ typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
1382 -+ if (0 == pExcTypeDescr)
1383 -+ {
1384 -+ RuntimeException aRE( OUString("exception type not found: ") + unoName );
1385 -+ Type const & rType = cppu::UnoType<decltype(aRE)>::get();
1386 -+ uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
1387 -+ SAL_WARN("bridges", aRE.Message);
1388 -+ }
1389 -+ else
1390 -+ {
1391 -+ // construct uno exception any
1392 -+ uno_any_constructAndConvert( pUnoExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
1393 -+ typelib_typedescription_release( pExcTypeDescr );
1394 -+ }
1395 -+}
1396 -+
1397 -+}
1398 -+
1399 -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1400 -diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/share.hxx
1401 -new file mode 100644
1402 -index 0000000..ee2235e
1403 ---- /dev/null
1404 -+++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/share.hxx
1405 -@@ -0,0 +1,89 @@
1406 -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
1407 -+/*
1408 -+ * This file is part of the LibreOffice project.
1409 -+ *
1410 -+ * This Source Code Form is subject to the terms of the Mozilla Public
1411 -+ * License, v. 2.0. If a copy of the MPL was not distributed with this
1412 -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
1413 -+ *
1414 -+ * This file incorporates work covered by the following license notice:
1415 -+ *
1416 -+ * Licensed to the Apache Software Foundation (ASF) under one or more
1417 -+ * contributor license agreements. See the NOTICE file distributed
1418 -+ * with this work for additional information regarding copyright
1419 -+ * ownership. The ASF licenses this file to you under the Apache
1420 -+ * License, Version 2.0 (the "License"); you may not use this file
1421 -+ * except in compliance with the License. You may obtain a copy of
1422 -+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
1423 -+ */
1424 -+#pragma once
1425 -+
1426 -+#include "uno/mapping.h"
1427 -+
1428 -+#include <typeinfo>
1429 -+#include <exception>
1430 -+#include <cstddef>
1431 -+
1432 -+#define MAX_GP_REGS (8)
1433 -+#define MAX_FP_REGS (8)
1434 -+
1435 -+namespace CPPU_CURRENT_NAMESPACE
1436 -+{
1437 -+
1438 -+ void dummy_can_throw_anything( char const * );
1439 -+
1440 -+
1441 -+// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
1442 -+
1443 -+struct _Unwind_Exception
1444 -+{
1445 -+ unsigned exception_class __attribute__((__mode__(__DI__)));
1446 -+ void * exception_cleanup;
1447 -+ unsigned private_1 __attribute__((__mode__(__word__)));
1448 -+ unsigned private_2 __attribute__((__mode__(__word__)));
1449 -+} __attribute__((__aligned__));
1450 -+
1451 -+struct __cxa_exception
1452 -+{
1453 -+ std::type_info *exceptionType;
1454 -+ void (*exceptionDestructor)(void *);
1455 -+
1456 -+ void (*unexpectedHandler)(); // std::unexpected_handler dropped from C++17
1457 -+ std::terminate_handler terminateHandler;
1458 -+
1459 -+ __cxa_exception *nextException;
1460 -+
1461 -+ int handlerCount;
1462 -+
1463 -+ int handlerSwitchValue;
1464 -+ const unsigned char *actionRecord;
1465 -+ const unsigned char *languageSpecificData;
1466 -+ void *catchTemp;
1467 -+ void *adjustedPtr;
1468 -+
1469 -+ _Unwind_Exception unwindHeader;
1470 -+};
1471 -+
1472 -+extern "C" void *__cxa_allocate_exception(
1473 -+ std::size_t thrown_size ) throw();
1474 -+extern "C" void __cxa_throw (
1475 -+ void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
1476 -+
1477 -+struct __cxa_eh_globals
1478 -+{
1479 -+ __cxa_exception *caughtExceptions;
1480 -+ unsigned int uncaughtExceptions;
1481 -+};
1482 -+
1483 -+extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
1484 -+extern "C" std::type_info *__cxa_current_exception_type() throw();
1485 -+
1486 -+void raiseException(
1487 -+ uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
1488 -+
1489 -+void fillUnoException(uno_Any *, uno_Mapping * pCpp2Uno);
1490 -+
1491 -+bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
1492 -+}
1493 -+
1494 -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
1495 -diff --git a/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx
1496 -new file mode 100644
1497 -index 0000000..cae7507
1498 ---- /dev/null
1499 -+++ b/bridges/source/cpp_uno/gcc3_linux_riscv64/uno2cpp.cxx
1500 -@@ -0,0 +1,595 @@
1501 -+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
1502 -+/*
1503 -+ * This file is part of the LibreOffice project.
1504 -+ *
1505 -+ * This Source Code Form is subject to the terms of the Mozilla Public
1506 -+ * License, v. 2.0. If a copy of the MPL was not distributed with this
1507 -+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
1508 -+ *
1509 -+ * This file incorporates work covered by the following license notice:
1510 -+ *
1511 -+ * Licensed to the Apache Software Foundation (ASF) under one or more
1512 -+ * contributor license agreements. See the NOTICE file distributed
1513 -+ * with this work for additional information regarding copyright
1514 -+ * ownership. The ASF licenses this file to you under the Apache
1515 -+ * License, Version 2.0 (the "License"); you may not use this file
1516 -+ * except in compliance with the License. You may obtain a copy of
1517 -+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
1518 -+ */
1519 -+
1520 -+#include <sal/config.h>
1521 -+
1522 -+#include <exception>
1523 -+#include <malloc.h>
1524 -+#include <cstring>
1525 -+#include <typeinfo>
1526 -+
1527 -+#include <com/sun/star/uno/Exception.hpp>
1528 -+#include <com/sun/star/uno/RuntimeException.hpp>
1529 -+#include <com/sun/star/uno/genfunc.hxx>
1530 -+#include <o3tl/runtimetooustring.hxx>
1531 -+#include <uno/data.h>
1532 -+
1533 -+#include "bridge.hxx"
1534 -+#include "types.hxx"
1535 -+#include "unointerfaceproxy.hxx"
1536 -+#include "vtables.hxx"
1537 -+
1538 -+#include "share.hxx"
1539 -+
1540 -+//#define BRDEBUG
1541 -+#ifdef BRDEBUG
1542 -+#include <stdio.h>
1543 -+#endif
1544 -+
1545 -+#define INSERT_FLOAT_DOUBLE( pSV, nr, pFPR, pDS ) \
1546 -+ if ( nr < MAX_FP_REGS ) \
1547 -+ pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \
1548 -+ else \
1549 -+ *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
1550 -+
1551 -+#define INSERT_INT64( pSV, nr, pGPR, pDS ) \
1552 -+ if ( nr < MAX_GP_REGS ) \
1553 -+ pGPR[nr++] = *reinterpret_cast<sal_Int64 *>( pSV ); \
1554 -+ else \
1555 -+ *pDS++ = *reinterpret_cast<sal_Int64 *>( pSV );
1556 -+
1557 -+#define INSERT_INT32( pSV, nr, pGPR, pDS ) \
1558 -+ if ( nr < MAX_GP_REGS ) \
1559 -+ pGPR[nr++] = *reinterpret_cast<sal_Int32 *>( pSV ); \
1560 -+ else \
1561 -+ *pDS++ = *reinterpret_cast<sal_Int32 *>( pSV );
1562 -+
1563 -+#define INSERT_INT16( pSV, nr, pGPR, pDS ) \
1564 -+ if ( nr < MAX_GP_REGS ) \
1565 -+ pGPR[nr++] = *reinterpret_cast<sal_Int16 *>( pSV ); \
1566 -+ else \
1567 -+ *pDS++ = *reinterpret_cast<sal_Int16 *>( pSV );
1568 -+
1569 -+#define INSERT_UINT16( pSV, nr, pGPR, pDS ) \
1570 -+ if ( nr < MAX_GP_REGS ) \
1571 -+ pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
1572 -+ else \
1573 -+ *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
1574 -+
1575 -+#define INSERT_INT8( pSV, nr, pGPR, pDS ) \
1576 -+ if ( nr < MAX_GP_REGS ) \
1577 -+ pGPR[nr++] = *reinterpret_cast<sal_Int8 *>( pSV ); \
1578 -+ else \
1579 -+ *pDS++ = *reinterpret_cast<sal_Int8 *>( pSV );
1580 -+
1581 -+using namespace ::com::sun::star::uno;
1582 -+
1583 -+namespace
1584 -+{
1585 -+
1586 -+ bool isReturnInFPR(const typelib_TypeDescription * pTypeDescr, sal_uInt32 & nSize)
1587 -+ {
1588 -+ const typelib_CompoundTypeDescription *p =
1589 -+ reinterpret_cast<const typelib_CompoundTypeDescription*>( pTypeDescr );
1590 -+
1591 -+ for (sal_Int32 i = 0; i < p->nMembers; ++i)
1592 -+ {
1593 -+ typelib_TypeDescriptionReference *pTypeInStruct = p->ppTypeRefs[ i ];
1594 -+
1595 -+ switch (pTypeInStruct->eTypeClass)
1596 -+ {
1597 -+ case typelib_TypeClass_STRUCT:
1598 -+ case typelib_TypeClass_EXCEPTION:
1599 -+ {
1600 -+ typelib_TypeDescription * t = 0;
1601 -+ TYPELIB_DANGER_GET(&t, pTypeInStruct);
1602 -+ bool isFPR = isReturnInFPR(t, nSize);
1603 -+ TYPELIB_DANGER_RELEASE(t);
1604 -+ if (!isFPR)
1605 -+ return false;
1606 -+ }
1607 -+ break;
1608 -+ case typelib_TypeClass_FLOAT:
1609 -+ case typelib_TypeClass_DOUBLE:
1610 -+ if (nSize >= 16)
1611 -+ return false;
1612 -+ nSize += 8;
1613 -+ break;
1614 -+ default:
1615 -+ return false;
1616 -+ }
1617 -+ }
1618 -+ return true;
1619 -+ }
1620 -+
1621 -+ void fillReturn(const typelib_TypeDescription * pTypeDescr,
1622 -+ sal_Int64 * gret, double * fret, void * pRegisterReturn)
1623 -+ {
1624 -+ sal_uInt32 nSize = 0;
1625 -+ if (isReturnInFPR(pTypeDescr, nSize))
1626 -+ {
1627 -+ reinterpret_cast<double *>( pRegisterReturn )[0] = fret[0];
1628 -+ reinterpret_cast<double *>( pRegisterReturn )[1] = fret[1];
1629 -+ }
1630 -+ else
1631 -+ {
1632 -+ reinterpret_cast<sal_Int64 *>( pRegisterReturn )[0] = gret[0];
1633 -+ reinterpret_cast<sal_Int64 *>( pRegisterReturn )[1] = gret[1];
1634 -+ }
1635 -+ }
1636 -+
1637 -+ static void callVirtualMethod(
1638 -+ void * pAdjustedThisPtr,
1639 -+ sal_Int32 nVtableIndex,
1640 -+ void * pRegisterReturn,
1641 -+ typelib_TypeDescriptionReference * pReturnTypeRef,
1642 -+ bool bSimpleReturn,
1643 -+ sal_uInt64 *pStack,
1644 -+ sal_uInt32 nStack,
1645 -+ sal_uInt64 *pGPR,
1646 -+ double *pFPR,
1647 -+ sal_uInt32 nREG)
1648 -+ {
1649 -+ // Should not happen, but...
1650 -+ static_assert(MAX_GP_REGS == MAX_FP_REGS, "must be the same size");
1651 -+ if ( nREG > MAX_GP_REGS )
1652 -+ nREG = MAX_GP_REGS;
1653 -+
1654 -+ // Get pointer to method
1655 -+ sal_uInt64 pMethod = *((sal_uInt64 *)pAdjustedThisPtr);
1656 -+ pMethod += 8 * nVtableIndex;
1657 -+ void *mfunc = (void *) *((sal_uInt64 *)pMethod);
1658 -+#ifdef BRDEBUG
1659 -+ fprintf(stdout, "calling function %p\n", mfunc);
1660 -+#endif
1661 -+
1662 -+ // Load parameters to stack, if necessary
1663 -+ sal_uInt64* pCallStack = NULL;
1664 -+ if ( nStack )
1665 -+ {
1666 -+ // 16-bytes aligned
1667 -+ sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16;
1668 -+ pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes );
1669 -+ std::memcpy( pCallStack, pStack, nStackBytes );
1670 -+ }
1671 -+
1672 -+ sal_Int64 gret[2];
1673 -+ double fret[2];
1674 -+ asm volatile (
1675 -+ //".set push \n\t"
1676 -+ //".set riscv64 \n\t"
1677 -+ // Fill the general purpose registers
1678 -+ "ld a0, 0(%[gpr]) \n\t"
1679 -+ "ld a1, 8(%[gpr]) \n\t"
1680 -+ "ld a2, 16(%[gpr]) \n\t"
1681 -+ "ld a3, 24(%[gpr]) \n\t"
1682 -+ "ld a4, 32(%[gpr]) \n\t"
1683 -+ "ld a5, 40(%[gpr]) \n\t"
1684 -+ "ld a6, 48(%[gpr]) \n\t"
1685 -+ "ld a7, 56(%[gpr]) \n\t"
1686 -+ // Fill the floating pointer registers
1687 -+ "fld fa0, 0(%[fpr]) \n\t"
1688 -+ "fld fa1, 8(%[fpr]) \n\t"
1689 -+ "fld fa2, 16(%[fpr]) \n\t"
1690 -+ "fld fa3, 24(%[fpr]) \n\t"
1691 -+ "fld fa4, 32(%[fpr]) \n\t"
1692 -+ "fld fa5, 40(%[fpr]) \n\t"
1693 -+ "fld fa6, 48(%[fpr]) \n\t"
1694 -+ "fld fa7, 56(%[fpr]) \n\t"
1695 -+ // Perform the call
1696 -+ "jalr ra,%[mfunc],0 \n\t"
1697 -+ // Fill the return values
1698 -+ "add %[gret1], a0,zero \n\t"
1699 -+ "add %[gret2], a1,zero \n\t"
1700 -+ "fcvt.d.l ft7,zero \n\t"
1701 -+ "fadd.d %[fret1], fa0,ft7 \n\t"
1702 -+ "fadd.d %[fret2], fa1,ft7 \n\t"
1703 -+ //".set pop \n\t"
1704 -+ :[gret1]"=r"(gret[0]), [gret2]"=r"(gret[1]),
1705 -+ [fret1]"=f"(fret[0]), [fret2]"=f"(fret[1])
1706 -+ :[gpr]"r"(pGPR), [fpr]"r"(pFPR), [mfunc]"r"(mfunc),
1707 -+ [stack]"m"(pCallStack) // dummy input to prevent the compiler from optimizing the alloca out
1708 -+ :"a0", "a1", "a2", "a3", "a4", "a5", "a6","a7",
1709 -+ "ra",
1710 -+ "fa0", "fa1", "fa2", "fa3", "fa4", "fa5", "fa6","fa7", "memory",
1711 -+ "ft7"
1712 -+ );
1713 -+
1714 -+ switch (pReturnTypeRef->eTypeClass)
1715 -+ {
1716 -+ case typelib_TypeClass_HYPER:
1717 -+ case typelib_TypeClass_UNSIGNED_HYPER:
1718 -+ case typelib_TypeClass_LONG:
1719 -+ case typelib_TypeClass_UNSIGNED_LONG:
1720 -+ case typelib_TypeClass_ENUM:
1721 -+ case typelib_TypeClass_CHAR:
1722 -+ case typelib_TypeClass_SHORT:
1723 -+ case typelib_TypeClass_UNSIGNED_SHORT:
1724 -+ case typelib_TypeClass_BOOLEAN:
1725 -+ case typelib_TypeClass_BYTE:
1726 -+ *reinterpret_cast<sal_Int64 *>( pRegisterReturn ) = gret[0];
1727 -+ break;
1728 -+ case typelib_TypeClass_FLOAT:
1729 -+ case typelib_TypeClass_DOUBLE:
1730 -+ *reinterpret_cast<double *>( pRegisterReturn ) = fret[0];
1731 -+ break;
1732 -+ case typelib_TypeClass_STRUCT:
1733 -+ case typelib_TypeClass_EXCEPTION:
1734 -+ {
1735 -+ sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize;
1736 -+ if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0)
1737 -+ {
1738 -+ typelib_TypeDescription * pTypeDescr = 0;
1739 -+ TYPELIB_DANGER_GET( &pTypeDescr, pReturnTypeRef );
1740 -+ fillReturn(pTypeDescr, gret, fret, pRegisterReturn);
1741 -+ TYPELIB_DANGER_RELEASE( pTypeDescr );
1742 -+ }
1743 -+ break;
1744 -+ }
1745 -+ default:
1746 -+#ifdef BRDEBUG
1747 -+ fprintf(stdout,"unhandled return type %u\n", pReturnTypeRef->eTypeClass);
1748 -+#endif
1749 -+ break;
1750 -+ }
1751 -+ }
1752 -+
1753 -+
1754 -+ static void cpp_call(
1755 -+ bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
1756 -+ bridges::cpp_uno::shared::VtableSlot aVtableSlot,
1757 -+ typelib_TypeDescriptionReference * pReturnTypeRef,
1758 -+ sal_Int32 nParams, typelib_MethodParameter * pParams,
1759 -+ void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
1760 -+ {
1761 -+ // max space for: [complex ret ptr], values|ptr ...
1762 -+ sal_uInt64 *pStack = (sal_uInt64 *)__builtin_alloca( ((nParams+3) * sizeof(sal_Int64)) );
1763 -+ sal_uInt64 *pStackStart = pStack;
1764 -+
1765 -+ sal_uInt64 pGPR[MAX_GP_REGS];
1766 -+ double pFPR[MAX_FP_REGS];
1767 -+ sal_uInt32 nREG = 0;
1768 -+
1769 -+#ifdef BRDEBUG
1770 -+ fprintf(stdout, "in cpp_call\n");
1771 -+#endif
1772 -+
1773 -+ // return
1774 -+ typelib_TypeDescription * pReturnTypeDescr = 0;
1775 -+ TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
1776 -+ assert(pReturnTypeDescr);
1777 -+
1778 -+ void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
1779 -+
1780 -+ bool bSimpleReturn = true;
1781 -+ if (pReturnTypeDescr)
1782 -+ {
1783 -+ if ( CPPU_CURRENT_NAMESPACE::return_in_hidden_param( pReturnTypeRef ) )
1784 -+ {
1785 -+ bSimpleReturn = false;
1786 -+ // complex return via ptr
1787 -+ pCppReturn = bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )?
1788 -+ __builtin_alloca( pReturnTypeDescr->nSize ) : pUnoReturn;
1789 -+ INSERT_INT64( &pCppReturn, nREG, pGPR, pStack );
1790 -+ }
1791 -+ else
1792 -+ {
1793 -+ pCppReturn = pUnoReturn; // direct way for simple types
1794 -+ }
1795 -+ }
1796 -+
1797 -+ // push this
1798 -+ void* pAdjustedThisPtr = reinterpret_cast< void **>( pThis->getCppI() ) + aVtableSlot.offset;
1799 -+ INSERT_INT64( &pAdjustedThisPtr, nREG, pGPR, pStack );
1800 -+
1801 -+ // args
1802 -+ void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
1803 -+ // indices of values this have to be converted (interface conversion cpp<=>uno)
1804 -+ sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
1805 -+ // type descriptions for reconversions
1806 -+ typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
1807 -+
1808 -+ sal_Int32 nTempIndices = 0;
1809 -+
1810 -+ for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
1811 -+ {
1812 -+ const typelib_MethodParameter & rParam = pParams[nPos];
1813 -+ typelib_TypeDescription * pParamTypeDescr = 0;
1814 -+ TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
1815 -+
1816 -+ if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
1817 -+ {
1818 -+ uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
1819 -+ pThis->getBridge()->getUno2Cpp() );
1820 -+
1821 -+ switch (pParamTypeDescr->eTypeClass)
1822 -+ {
1823 -+ case typelib_TypeClass_LONG:
1824 -+ case typelib_TypeClass_UNSIGNED_LONG:
1825 -+ INSERT_INT64( pCppArgs[nPos], nREG, pGPR, pStack );
1826 -+ break;
1827 -+ case typelib_TypeClass_ENUM:
1828 -+ INSERT_INT32( pCppArgs[nPos], nREG, pGPR, pStack );
1829 -+ break;
1830 -+ case typelib_TypeClass_CHAR:
1831 -+ case typelib_TypeClass_SHORT:
1832 -+ INSERT_INT16( pCppArgs[nPos], nREG, pGPR, pStack );
1833 -+ break;
1834 -+ case typelib_TypeClass_UNSIGNED_SHORT:
1835 -+ INSERT_UINT16( pCppArgs[nPos], nREG, pGPR, pStack );
1836 -+ break;
1837 -+ case typelib_TypeClass_BOOLEAN:
1838 -+ case typelib_TypeClass_BYTE:
1839 -+ INSERT_INT8( pCppArgs[nPos], nREG, pGPR, pStack );
1840 -+ break;
1841 -+ case typelib_TypeClass_FLOAT:
1842 -+ case typelib_TypeClass_DOUBLE:
1843 -+ INSERT_FLOAT_DOUBLE( pCppArgs[nPos], nREG, pFPR, pStack );
1844 -+ break;
1845 -+ case typelib_TypeClass_HYPER:
1846 -+ case typelib_TypeClass_UNSIGNED_HYPER:
1847 -+ INSERT_INT64( pCppArgs[nPos], nREG, pGPR, pStack );
1848 -+ break;
1849 -+ default:
1850 -+ break;
1851 -+ }
1852 -+
1853 -+ // no longer needed
1854 -+ TYPELIB_DANGER_RELEASE( pParamTypeDescr );
1855 -+ }
1856 -+ else // ptr to complex value | ref
1857 -+ {
1858 -+ if (! rParam.bIn) // is pure out
1859 -+ {
1860 -+ // cpp out is constructed mem, uno out is not!
1861 -+ uno_constructData(
1862 -+ pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
1863 -+ pParamTypeDescr );
1864 -+ pTempIndices[nTempIndices] = nPos; // default constructed for cpp call
1865 -+ // will be released at reconversion
1866 -+ ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
1867 -+ }
1868 -+ // is in/inout
1869 -+ else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
1870 -+ {
1871 -+ uno_copyAndConvertData(
1872 -+ pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
1873 -+ pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
1874 -+
1875 -+ pTempIndices[nTempIndices] = nPos; // has to be reconverted
1876 -+ // will be released at reconversion
1877 -+ ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
1878 -+ }
1879 -+ else // direct way
1880 -+ {
1881 -+ pCppArgs[nPos] = pUnoArgs[nPos];
1882 -+ // no longer needed
1883 -+ TYPELIB_DANGER_RELEASE( pParamTypeDescr );
1884 -+ }
1885 -+ INSERT_INT64( &(pCppArgs[nPos]), nREG, pGPR, pStack );
1886 -+ }
1887 -+ }
1888 -+
1889 -+ try
1890 -+ {
1891 -+ try {
1892 -+ callVirtualMethod(
1893 -+ pAdjustedThisPtr, aVtableSlot.index,
1894 -+ pCppReturn, pReturnTypeRef, bSimpleReturn,
1895 -+ pStackStart, ( pStack - pStackStart ),
1896 -+ pGPR, pFPR, nREG);
1897 -+ } catch (css::uno::Exception &) {
1898 -+ throw;
1899 -+ } catch (std::exception & e) {
1900 -+ throw css::uno::RuntimeException(
1901 -+ "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": "
1902 -+ + o3tl::runtimeToOUString(e.what()));
1903 -+ } catch (...) {
1904 -+ throw css::uno::RuntimeException("C++ code threw unknown exception");
1905 -+ }
1906 -+ // NO exception occurred...
1907 -+ *ppUnoExc = 0;
1908 -+
1909 -+ // reconvert temporary params
1910 -+ for ( ; nTempIndices--; )
1911 -+ {
1912 -+ sal_Int32 nIndex = pTempIndices[nTempIndices];
1913 -+ typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
1914 -+
1915 -+ if (pParams[nIndex].bIn)
1916 -+ {
1917 -+ if (pParams[nIndex].bOut) // inout
1918 -+ {
1919 -+ uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
1920 -+ uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
1921 -+ pThis->getBridge()->getCpp2Uno() );
1922 -+ }
1923 -+ }
1924 -+ else // pure out
1925 -+ {
1926 -+ uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
1927 -+ pThis->getBridge()->getCpp2Uno() );
1928 -+ }
1929 -+ // destroy temp cpp param => cpp: every param was constructed
1930 -+ uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
1931 -+
1932 -+ TYPELIB_DANGER_RELEASE( pParamTypeDescr );
1933 -+ }
1934 -+ // return value
1935 -+ if (pCppReturn && pUnoReturn != pCppReturn)
1936 -+ {
1937 -+ uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
1938 -+ pThis->getBridge()->getCpp2Uno() );
1939 -+ uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
1940 -+ }
1941 -+ }
1942 -+ catch (...)
1943 -+ {
1944 -+ // fill uno exception
1945 -+ CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc, pThis->getBridge()->getCpp2Uno());
1946 -+
1947 -+ // temporary params
1948 -+ for ( ; nTempIndices--; )
1949 -+ {
1950 -+ sal_Int32 nIndex = pTempIndices[nTempIndices];
1951 -+ // destroy temp cpp param => cpp: every param was constructed
1952 -+ uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices], cpp_release );
1953 -+ TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
1954 -+ }
1955 -+ // return type
1956 -+ if (pReturnTypeDescr)
1957 -+ TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
1958 -+ }
1959 -+ }
1960 -+
1961 -+}
1962 -+
1963 -+
1964 -+namespace bridges::cpp_uno::shared {
1965 -+
1966 -+void unoInterfaceProxyDispatch(
1967 -+ uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
1968 -+ void * pReturn, void * pArgs[], uno_Any ** ppException )
1969 -+{
1970 -+ // is my surrogate
1971 -+ bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
1972 -+ = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy *> (pUnoI);
1973 -+ //typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
1974 -+
1975 -+#ifdef BRDEBUG
1976 -+ fprintf(stdout, "in dispatch\n");
1977 -+#endif
1978 -+
1979 -+ switch (pMemberDescr->eTypeClass)
1980 -+ {
1981 -+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
1982 -+ {
1983 -+
1984 -+ VtableSlot aVtableSlot(
1985 -+ getVtableSlot(
1986 -+ reinterpret_cast<
1987 -+ typelib_InterfaceAttributeTypeDescription const * >(
1988 -+ pMemberDescr)));
1989 -+
1990 -+ if (pReturn)
1991 -+ {
1992 -+ // dependent dispatch
1993 -+ cpp_call(
1994 -+ pThis, aVtableSlot,
1995 -+ ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
1996 -+ 0, 0, // no params
1997 -+ pReturn, pArgs, ppException );
1998 -+ }
1999 -+ else
2000 -+ {
2001 -+ // is SET
2002 -+ typelib_MethodParameter aParam;
2003 -+ aParam.pTypeRef =
2004 -+ ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
2005 -+ aParam.bIn = sal_True;
2006 -+ aParam.bOut = sal_False;
2007 -+
2008 -+ typelib_TypeDescriptionReference * pReturnTypeRef = 0;
2009 -+ OUString aVoidName("void");
2010 -+ typelib_typedescriptionreference_new(
2011 -+ &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
2012 -+
2013 -+ // dependent dispatch
2014 -+ aVtableSlot.index += 1; //get then set method
2015 -+ cpp_call(
2016 -+ pThis, aVtableSlot,
2017 -+ pReturnTypeRef,
2018 -+ 1, &aParam,
2019 -+ pReturn, pArgs, ppException );
2020 -+
2021 -+ typelib_typedescriptionreference_release( pReturnTypeRef );
2022 -+ }
2023 -+
2024 -+ break;
2025 -+ }
2026 -+ case typelib_TypeClass_INTERFACE_METHOD:
2027 -+ {
2028 -+
2029 -+ VtableSlot aVtableSlot(
2030 -+ getVtableSlot(
2031 -+ reinterpret_cast<
2032 -+ typelib_InterfaceMethodTypeDescription const * >(
2033 -+ pMemberDescr)));
2034 -+ switch (aVtableSlot.index)
2035 -+ {
2036 -+ // standard calls
2037 -+ case 1: // acquire uno interface
2038 -+ (*pUnoI->acquire)( pUnoI );
2039 -+ *ppException = 0;
2040 -+ break;
2041 -+ case 2: // release uno interface
2042 -+ (*pUnoI->release)( pUnoI );
2043 -+ *ppException = 0;
2044 -+ break;
2045 -+ case 0: // queryInterface() opt
2046 -+ {
2047 -+ typelib_TypeDescription * pTD = 0;
2048 -+ TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
2049 -+ if (pTD)
2050 -+ {
2051 -+ uno_Interface * pInterface = 0;
2052 -+ (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(pThis->pBridge->getUnoEnv(),
2053 -+ (void **)&pInterface, pThis->oid.pData,
2054 -+ (typelib_InterfaceTypeDescription *)pTD );
2055 -+
2056 -+ if (pInterface)
2057 -+ {
2058 -+ ::uno_any_construct(
2059 -+ reinterpret_cast< uno_Any * >( pReturn ),
2060 -+ &pInterface, pTD, 0 );
2061 -+ (*pInterface->release)( pInterface );
2062 -+ TYPELIB_DANGER_RELEASE( pTD );
2063 -+ *ppException = 0;
2064 -+ break;
2065 -+ }
2066 -+ TYPELIB_DANGER_RELEASE( pTD );
2067 -+ }
2068 -+ } // else perform queryInterface()
2069 -+ default:
2070 -+ // dependent dispatch
2071 -+ cpp_call(
2072 -+ pThis, aVtableSlot,
2073 -+ ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
2074 -+ ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
2075 -+ ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
2076 -+ pReturn, pArgs, ppException );
2077 -+ }
2078 -+ break;
2079 -+ }
2080 -+ default:
2081 -+ {
2082 -+ ::com::sun::star::uno::RuntimeException aExc(
2083 -+ "illegal member type description!",
2084 -+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
2085 -+
2086 -+ Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
2087 -+ // binary identical null reference
2088 -+ ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
2089 -+ }
2090 -+ }
2091 -+}
2092 -+
2093 -+}
2094 -+
2095 -+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
2096 -diff --git a/configure.ac b/configure.ac
2097 -index 8c868fa..5fbd4fc 100644
2098 ---- a/configure.ac
2099 -+++ b/configure.ac
2100 -@@ -5085,6 +5085,12 @@ linux-gnu*|linux-musl*)
2101 - EPM_FLAGS="-a mipsel"
2102 - PLATFORMID=linux_mips_el
2103 - ;;
2104 -+ riscv64)
2105 -+ CPUNAME=RISCV64
2106 -+ RTL_ARCH=RISCV64
2107 -+ EPM_FLAGS="-a riscv64"
2108 -+ PLATFORMID=linux_riscv64
2109 -+ ;;
2110 - m68k)
2111 - CPUNAME=M68K
2112 - RTL_ARCH=M68K
2113 -@@ -8411,7 +8417,7 @@ if test "$ENABLE_JAVA" != ""; then
2114 - JAVAINTERPRETER=`win_short_path_for_make "$JAVAINTERPRETER"`
2115 - elif test "$cross_compiling" != "yes"; then
2116 - case $CPUNAME in
2117 -- AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64)
2118 -+ AARCH64|AXP|X86_64|HPPA|IA64|POWERPC64|S390X|SPARC64|GODSON64|RISCV64)
2119 - if test -f "$JAVAINTERPRETER" -a "`$JAVAINTERPRETER -version 2>&1 | $GREP -i 64-bit`" = "" >/dev/null; then
2120 - AC_MSG_WARN([You are building 64-bit binaries but the JDK $JAVAINTERPRETER is 32-bit])
2121 - AC_MSG_ERROR([You should pass the --with-jdk-home option pointing to a 64-bit JDK])
2122 -@@ -12830,7 +12836,7 @@ AC_SUBST(RHINO_JAR)
2123 - # platforms there.
2124 - supports_multilib=
2125 - case "$host_cpu" in
2126 --x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64)
2127 -+x86_64 | powerpc64 | powerpc64le | s390x | aarch64 | mips64 | mips64el | loongarch64 | riscv64)
2128 - if test "$SAL_TYPES_SIZEOFLONG" = "8"; then
2129 - supports_multilib="yes"
2130 - fi
2131 -diff --git a/jvmfwk/inc/vendorbase.hxx b/jvmfwk/inc/vendorbase.hxx
2132 -index c0008c5..de4647b 100644
2133 ---- a/jvmfwk/inc/vendorbase.hxx
2134 -+++ b/jvmfwk/inc/vendorbase.hxx
2135 -@@ -59,6 +59,8 @@ OpenJDK at least, but probably not true for Lemotes JDK */
2136 - #else
2137 - #define JFW_PLUGIN_ARCH "mips64el"
2138 - #endif
2139 -+#elif defined RISCV64
2140 -+#define JFW_PLUGIN_ARCH "riscv64"
2141 - #elif defined S390X
2142 - #define JFW_PLUGIN_ARCH "s390x"
2143 - #elif defined S390
2144 -diff --git a/solenv/gbuild/platform/LINUX_RISCV64_GCC.mk b/solenv/gbuild/platform/LINUX_RISCV64_GCC.mk
2145 -new file mode 100644
2146 -index 0000000..9e00710
2147 ---- /dev/null
2148 -+++ b/solenv/gbuild/platform/LINUX_RISCV64_GCC.mk
2149 -@@ -0,0 +1,15 @@
2150 -+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
2151 -+#
2152 -+# This file is part of the LibreOffice project.
2153 -+#
2154 -+# This Source Code Form is subject to the terms of the Mozilla Public
2155 -+# License, v. 2.0. If a copy of the MPL was not distributed with this
2156 -+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
2157 -+#
2158 -+
2159 -+#please make generic modifications to unxgcc.mk or linux.mk
2160 -+gb_COMPILEROPTFLAGS := -Os
2161 -+
2162 -+include $(GBUILDDIR)/platform/linux.mk
2163 -+
2164 -+# vim: set noet sw=4:
2165 ---
2166 -2.37.2
2167 -
2168
2169 diff --git a/app-office/libreoffice/libreoffice-7.3.6.2.ebuild b/app-office/libreoffice/libreoffice-7.3.7.2.ebuild
2170 similarity index 99%
2171 rename from app-office/libreoffice/libreoffice-7.3.6.2.ebuild
2172 rename to app-office/libreoffice/libreoffice-7.3.7.2.ebuild
2173 index 2582c1b..5d536f2 100644
2174 --- a/app-office/libreoffice/libreoffice-7.3.6.2.ebuild
2175 +++ b/app-office/libreoffice/libreoffice-7.3.7.2.ebuild
2176 @@ -103,7 +103,7 @@ LICENSE="|| ( LGPL-3 MPL-1.1 )"
2177 SLOT="0"
2178
2179 [[ ${MY_PV} == *9999* ]] || \
2180 -KEYWORDS="amd64 ~arm ~arm64 ~loong ~ppc64 x86 ~amd64-linux"
2181 +KEYWORDS="amd64 ~arm arm64 ~loong ~ppc64 ~x86 ~amd64-linux"
2182
2183 COMMON_DEPEND="${PYTHON_DEPS}
2184 app-arch/unzip
2185 @@ -294,12 +294,6 @@ PATCHES=(
2186
2187 # 7.4 branch
2188 "${FILESDIR}/${PN}-7.3.5.2-gpgme-1.18.0.patch"
2189 -
2190 - # pending upstream
2191 - "${FILESDIR}/${PN}-7.3.5.2-poppler-22.09.0.patch"
2192 -
2193 - # riscv64 port
2194 - "${FILESDIR}/${PN}-7.3.6.2-riscv64.patch"
2195 )
2196
2197 S="${WORKDIR}/${PN}-${MY_PV}"