[Libreoffice-commits] core.git: Branch 'private/jmux/win-arm64' - 89 commits - android/Bootstrap avmedia/Library_avmediagst.mk avmedia/Library_avmediavlc.mk avmedia/source basctl/source bin/find-can-be-private-symbols.classes.results bin/find-can-be-private-symbols.functions.results bin/find-can-be-private-symbols.py bin/find-headers-to-move-inside-modules.py bin/get_config_variables bin/gla11y bridges/Library_cpp_uno.mk bridges/source canvas/Library_cairocanvas.mk canvas/source chart2/source compilerplugins/clang configmgr/Library_configmgr.mk configmgr/source configure.ac connectivity/Module_connectivity.mk cppcanvas/source cui/Library_cui.mk cui/source cui/uiconfig cui/util desktop/source download.lst drawinglayer/drawinglayer.component drawinglayer/Library_drawinglayer.mk drawinglayer/source editeng/source embedserv/Library_emser.mk embedserv/source embedserv/util emfio/emfio.component emfio/Library_emfio.mk emfio/source external/icu external/libffi external/openssl external/python3 filter/Mo dule_filter.mk formula/Library_for.mk formula/source formula/util framework/inc framework/source framework/util helpcontent2 include/drawinglayer include/editeng include/filter include/formula include/framework include/oox include/osl include/sal include/sax include/sfx2 include/svtools include/svx include/vcl Makefile.gbuild odk/examples offapi/com officecfg/registry oox/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk RepositoryExternal.mk Repository.mk RepositoryModule_build.mk sal/osl sc/inc sc/qa sc/source sd/sdi sd/source sd/uiconfig sfx2/source solenv/bin solenv/clang-format solenv/gbuild solenv/sanitizers svl/source svtools/source svtools/uiconfig svx/inc svx/Module_svx.mk svx/sdi svx/source sw/inc sw/qa sw/source sw/uiconfig toolkit/source unoxml/Module_unoxml.mk vcl/inc vcl/Library_vclplug_osx.mk vcl/skia vcl/source vcl/unx vcl/vcl.android.component vcl/vcl.headless.component vcl/vcl.ios.component vcl/vcl.macosx.component vcl/vcl.unx.component vcl/vc l.windows.component writerfilter/source xmlhelp/Library_ucpchelp1.mk xmlhelp/source xmlhelp/util xmloff/Library_xof.mk xmloff/Module_xmloff.mk xmloff/source xmloff/util xmlscript/Library_xmlscript.mk xmlscript/source xmlscript/util

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 8 08:14:32 UTC 2020


Rebased ref, commits from common ancestor:
commit b17222b6206877be316c11ab9f6309ef3111487d
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Jul 8 03:09:10 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Jul 8 10:13:01 2020 +0200

    python3: upgrade to 3.8.3
    
    With all the prerequisites in place, LO can upgrade to the
    current Python release. Interestingly I found that cygwin
    always seems to LC_COLLATE=C, as the default collation rules
    are missing.
    
    Change-Id: Ib82f7b77213da9c525f8c79a13d128d9eec9ca64

diff --git a/configure.ac b/configure.ac
index 66e33cc61ad7..5d2232adf9df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9093,8 +9093,8 @@ int main(int argc, char **argv) {
 internal)
     SYSTEM_PYTHON=
     PYTHON_VERSION_MAJOR=3
-    PYTHON_VERSION_MINOR=7
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.7
+    PYTHON_VERSION_MINOR=8
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.3
     if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
         AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in download.lst])
     fi
diff --git a/download.lst b/download.lst
index 6c684aceac6f..eca88453751c 100644
--- a/download.lst
+++ b/download.lst
@@ -222,8 +222,8 @@ export POPPLER_SHA256SUM := 234f8e573ea57fb6a008e7c1e56bfae1af5d1adf0e65f47555e1
 export POPPLER_TARBALL := poppler-0.82.0.tar.xz
 export POSTGRESQL_SHA256SUM := a754c02f7051c2f21e52f8669a421b50485afcde9a581674d6106326b189d126
 export POSTGRESQL_TARBALL := postgresql-9.2.24.tar.bz2
-export PYTHON_SHA256SUM := 06a0a9f1bf0d8cd1e4121194d666c4e28ddae4dd54346de6c343206599f02136
-export PYTHON_TARBALL := Python-3.7.7.tar.xz
+export PYTHON_SHA256SUM := dfab5ec723c218082fe3d5d7ae17ecbdebffa9a1aea4d64aa3a2ecdd2e795864
+export PYTHON_TARBALL := Python-3.8.3.tar.xz
 export QRCODEGEN_SHA256SUM := fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a
 export QRCODEGEN_TARBALL := QR-Code-generator-1.4.0.tar.gz
 export QXP_SHA256SUM := e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c
diff --git a/external/python3/ExternalPackage_python3.mk b/external/python3/ExternalPackage_python3.mk
index 4dfc3b196f82..214c0d5c0ff5 100644
--- a/external/python3/ExternalPackage_python3.mk
+++ b/external/python3/ExternalPackage_python3.mk
@@ -150,6 +150,10 @@ endif
 # idlelib, tkinter, turtledemo - need Tk to build the C module
 # test - probably unnecessary? was explicitly removed #i116738#
 # venv - why would we need virtual environments
+#
+# These lists are now sorted with "LC_COLLATE=C sort", by using
+#   find Lib/ -name "*.py" | sort | sed -e 's/^/\t/' -e 's/$/ \\/'
+#
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib,\
 	LICENSE \
@@ -162,6 +166,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/_dummy_thread.py \
 	Lib/_markupbase.py \
 	Lib/_osx_support.py \
+	Lib/_py_abc.py \
 	Lib/_pydecimal.py \
 	Lib/_pyio.py \
 	Lib/_sitebuiltins.py \
@@ -180,6 +185,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/binhex.py \
 	Lib/bisect.py \
 	Lib/bz2.py \
+	Lib/cProfile.py \
 	Lib/calendar.py \
 	Lib/cgi.py \
 	Lib/cgitb.py \
@@ -195,7 +201,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/contextvars.py \
 	Lib/copy.py \
 	Lib/copyreg.py \
-	Lib/cProfile.py \
 	Lib/crypt.py \
 	Lib/csv.py \
 	Lib/dataclasses.py \
@@ -232,7 +237,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/linecache.py \
 	Lib/locale.py \
 	Lib/lzma.py \
-	Lib/macpath.py \
 	Lib/mailbox.py \
 	Lib/mailcap.py \
 	Lib/mimetypes.py \
@@ -260,21 +264,20 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/profile.py \
 	Lib/pstats.py \
 	Lib/pty.py \
-	Lib/pyclbr.py \
-	Lib/_py_abc.py \
 	Lib/py_compile.py \
+	Lib/pyclbr.py \
 	Lib/pydoc.py \
 	Lib/queue.py \
 	Lib/quopri.py \
 	Lib/random.py \
-	Lib/reprlib.py \
 	Lib/re.py \
+	Lib/reprlib.py \
 	Lib/rlcompleter.py \
 	Lib/runpy.py \
 	Lib/sched.py \
 	Lib/secrets.py \
-	Lib/shelve.py \
 	Lib/selectors.py \
+	Lib/shelve.py \
 	Lib/shlex.py \
 	Lib/shutil.py \
 	Lib/signal.py \
@@ -288,10 +291,10 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/sre_constants.py \
 	Lib/sre_parse.py \
 	Lib/ssl.py \
-	Lib/statistics.py \
 	Lib/stat.py \
-	Lib/stringprep.py \
+	Lib/statistics.py \
 	Lib/string.py \
+	Lib/stringprep.py \
 	Lib/struct.py \
 	Lib/subprocess.py \
 	Lib/sunau.py \
@@ -306,10 +309,11 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/this.py \
 	Lib/threading.py \
 	Lib/timeit.py \
-	Lib/tokenize.py \
 	Lib/token.py \
-	Lib/traceback.py \
+	Lib/tokenize.py \
 	Lib/trace.py \
+	Lib/traceback.py \
+	Lib/tracemalloc.py \
 	Lib/tty.py \
 	Lib/turtle.py \
 	Lib/types.py \
@@ -321,14 +325,41 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/weakref.py \
 	Lib/webbrowser.py \
 	Lib/xdrlib.py \
+	Lib/zipapp.py \
 	Lib/zipfile.py \
+	Lib/zipimport.py \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/asyncio,\
+	Lib/asyncio/__init__.py \
+	Lib/asyncio/__main__.py \
+	Lib/asyncio/base_events.py \
 	Lib/asyncio/base_futures.py \
+	Lib/asyncio/base_subprocess.py \
 	Lib/asyncio/base_tasks.py \
+	Lib/asyncio/constants.py \
+	Lib/asyncio/coroutines.py \
+	Lib/asyncio/events.py \
+	Lib/asyncio/exceptions.py \
 	Lib/asyncio/format_helpers.py \
+	Lib/asyncio/futures.py \
+	Lib/asyncio/locks.py \
+	Lib/asyncio/log.py \
+	Lib/asyncio/proactor_events.py \
+	Lib/asyncio/protocols.py \
+	Lib/asyncio/queues.py \
 	Lib/asyncio/runners.py \
+	Lib/asyncio/selector_events.py \
+	Lib/asyncio/sslproto.py \
+	Lib/asyncio/staggered.py \
+	Lib/asyncio/streams.py \
+	Lib/asyncio/subprocess.py \
+	Lib/asyncio/tasks.py \
+	Lib/asyncio/transports.py \
+	Lib/asyncio/trsock.py \
+	Lib/asyncio/unix_events.py \
+	Lib/asyncio/windows_events.py \
+	Lib/asyncio/windows_utils.py \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/collections,\
@@ -383,8 +414,8 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/distutils/errors.py \
 	Lib/distutils/extension.py \
 	Lib/distutils/fancy_getopt.py \
-	Lib/distutils/filelist.py \
 	Lib/distutils/file_util.py \
+	Lib/distutils/filelist.py \
 	Lib/distutils/log.py \
 	Lib/distutils/msvc9compiler.py \
 	Lib/distutils/msvccompiler.py \
@@ -393,44 +424,44 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/distutils/text_file.py \
 	Lib/distutils/unixccompiler.py \
 	Lib/distutils/util.py \
-	Lib/distutils/versionpredicate.py \
 	Lib/distutils/version.py \
+	Lib/distutils/versionpredicate.py \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/distutils/command,\
 	Lib/distutils/command/__init__.py \
+	Lib/distutils/command/bdist.py \
 	Lib/distutils/command/bdist_dumb.py \
 	Lib/distutils/command/bdist_msi.py \
-	Lib/distutils/command/bdist.py \
 	Lib/distutils/command/bdist_rpm.py \
 	Lib/distutils/command/bdist_wininst.py \
+	Lib/distutils/command/build.py \
 	Lib/distutils/command/build_clib.py \
 	Lib/distutils/command/build_ext.py \
-	Lib/distutils/command/build.py \
 	Lib/distutils/command/build_py.py \
 	Lib/distutils/command/build_scripts.py \
 	Lib/distutils/command/check.py \
 	Lib/distutils/command/clean.py \
 	Lib/distutils/command/command_template \
 	Lib/distutils/command/config.py \
+	Lib/distutils/command/install.py \
 	Lib/distutils/command/install_data.py \
 	Lib/distutils/command/install_egg_info.py \
 	Lib/distutils/command/install_headers.py \
 	Lib/distutils/command/install_lib.py \
-	Lib/distutils/command/install.py \
 	Lib/distutils/command/install_scripts.py \
 	Lib/distutils/command/register.py \
 	Lib/distutils/command/sdist.py \
 	Lib/distutils/command/upload.py \
-	Lib/distutils/command/wininst-10.0-amd64.exe \
 	Lib/distutils/command/wininst-10.0.exe \
-	Lib/distutils/command/wininst-14.0-amd64.exe \
+	Lib/distutils/command/wininst-10.0-amd64.exe \
 	Lib/distutils/command/wininst-14.0.exe \
+	Lib/distutils/command/wininst-14.0-amd64.exe \
 	Lib/distutils/command/wininst-6.0.exe \
 	Lib/distutils/command/wininst-7.1.exe \
 	Lib/distutils/command/wininst-8.0.exe \
-	Lib/distutils/command/wininst-9.0-amd64.exe \
 	Lib/distutils/command/wininst-9.0.exe \
+	Lib/distutils/command/wininst-9.0-amd64.exe \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/email,\
@@ -474,8 +505,8 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/encodings/aliases.py \
 	Lib/encodings/ascii.py \
 	Lib/encodings/base64_codec.py \
-	Lib/encodings/big5hkscs.py \
 	Lib/encodings/big5.py \
+	Lib/encodings/big5hkscs.py \
 	Lib/encodings/bz2_codec.py \
 	Lib/encodings/charmap.py \
 	Lib/encodings/cp037.py \
@@ -492,10 +523,10 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/encodings/cp1256.py \
 	Lib/encodings/cp1257.py \
 	Lib/encodings/cp1258.py \
+	Lib/encodings/cp273.py \
 	Lib/encodings/cp424.py \
 	Lib/encodings/cp437.py \
 	Lib/encodings/cp500.py \
-	Lib/encodings/cp65001.py \
 	Lib/encodings/cp720.py \
 	Lib/encodings/cp737.py \
 	Lib/encodings/cp775.py \
@@ -529,20 +560,20 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/encodings/hp_roman8.py \
 	Lib/encodings/hz.py \
 	Lib/encodings/idna.py \
+	Lib/encodings/iso2022_jp.py \
 	Lib/encodings/iso2022_jp_1.py \
-	Lib/encodings/iso2022_jp_2004.py \
 	Lib/encodings/iso2022_jp_2.py \
+	Lib/encodings/iso2022_jp_2004.py \
 	Lib/encodings/iso2022_jp_3.py \
 	Lib/encodings/iso2022_jp_ext.py \
-	Lib/encodings/iso2022_jp.py \
 	Lib/encodings/iso2022_kr.py \
+	Lib/encodings/iso8859_1.py \
 	Lib/encodings/iso8859_10.py \
 	Lib/encodings/iso8859_11.py \
 	Lib/encodings/iso8859_13.py \
 	Lib/encodings/iso8859_14.py \
 	Lib/encodings/iso8859_15.py \
 	Lib/encodings/iso8859_16.py \
-	Lib/encodings/iso8859_1.py \
 	Lib/encodings/iso8859_2.py \
 	Lib/encodings/iso8859_3.py \
 	Lib/encodings/iso8859_4.py \
@@ -565,8 +596,8 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/encodings/mac_greek.py \
 	Lib/encodings/mac_iceland.py \
 	Lib/encodings/mac_latin2.py \
-	Lib/encodings/mac_romanian.py \
 	Lib/encodings/mac_roman.py \
+	Lib/encodings/mac_romanian.py \
 	Lib/encodings/mac_turkish.py \
 	Lib/encodings/mbcs.py \
 	Lib/encodings/oem.py \
@@ -576,19 +607,18 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/encodings/quopri_codec.py \
 	Lib/encodings/raw_unicode_escape.py \
 	Lib/encodings/rot_13.py \
-	Lib/encodings/shift_jis_2004.py \
 	Lib/encodings/shift_jis.py \
+	Lib/encodings/shift_jis_2004.py \
 	Lib/encodings/shift_jisx0213.py \
 	Lib/encodings/tis_620.py \
 	Lib/encodings/undefined.py \
 	Lib/encodings/unicode_escape.py \
-	Lib/encodings/unicode_internal.py \
+	Lib/encodings/utf_16.py \
 	Lib/encodings/utf_16_be.py \
 	Lib/encodings/utf_16_le.py \
-	Lib/encodings/utf_16.py \
+	Lib/encodings/utf_32.py \
 	Lib/encodings/utf_32_be.py \
 	Lib/encodings/utf_32_le.py \
-	Lib/encodings/utf_32.py \
 	Lib/encodings/utf_7.py \
 	Lib/encodings/utf_8.py \
 	Lib/encodings/utf_8_sig.py \
@@ -616,6 +646,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/importlib/_bootstrap_external.py \
 	Lib/importlib/abc.py \
 	Lib/importlib/machinery.py \
+	Lib/importlib/metadata.py \
 	Lib/importlib/resources.py \
 	Lib/importlib/util.py \
 ))
@@ -652,8 +683,8 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/lib2to3/fixes/fix_buffer.py \
 	Lib/lib2to3/fixes/fix_dict.py \
 	Lib/lib2to3/fixes/fix_except.py \
-	Lib/lib2to3/fixes/fix_execfile.py \
 	Lib/lib2to3/fixes/fix_exec.py \
+	Lib/lib2to3/fixes/fix_execfile.py \
 	Lib/lib2to3/fixes/fix_exitfunc.py \
 	Lib/lib2to3/fixes/fix_filter.py \
 	Lib/lib2to3/fixes/fix_funcattrs.py \
@@ -662,13 +693,13 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/lib2to3/fixes/fix_has_key.py \
 	Lib/lib2to3/fixes/fix_idioms.py \
 	Lib/lib2to3/fixes/fix_import.py \
-	Lib/lib2to3/fixes/fix_imports2.py \
 	Lib/lib2to3/fixes/fix_imports.py \
+	Lib/lib2to3/fixes/fix_imports2.py \
 	Lib/lib2to3/fixes/fix_input.py \
 	Lib/lib2to3/fixes/fix_intern.py \
 	Lib/lib2to3/fixes/fix_isinstance.py \
-	Lib/lib2to3/fixes/fix_itertools_imports.py \
 	Lib/lib2to3/fixes/fix_itertools.py \
+	Lib/lib2to3/fixes/fix_itertools_imports.py \
 	Lib/lib2to3/fixes/fix_long.py \
 	Lib/lib2to3/fixes/fix_map.py \
 	Lib/lib2to3/fixes/fix_metaclass.py \
@@ -708,8 +739,8 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/lib2to3/pgen2/literals.py \
 	Lib/lib2to3/pgen2/parse.py \
 	Lib/lib2to3/pgen2/pgen.py \
-	Lib/lib2to3/pgen2/tokenize.py \
 	Lib/lib2to3/pgen2/token.py \
+	Lib/lib2to3/pgen2/tokenize.py \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/logging,\
@@ -718,13 +749,25 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/logging/handlers.py \
 ))
 
+ifeq (WNT,$(OS))
+$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/msilib,\
+	Lib/msilib/__init__.py \
+	Lib/msilib/schema.py \
+	Lib/msilib/sequence.py \
+	Lib/msilib/text.py \
+))
+endif
+
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/multiprocessing,\
 	Lib/multiprocessing/__init__.py \
 	Lib/multiprocessing/connection.py \
 	Lib/multiprocessing/context.py \
+	Lib/multiprocessing/dummy/__init__.py \
+	Lib/multiprocessing/dummy/connection.py \
 	Lib/multiprocessing/forkserver.py \
 	Lib/multiprocessing/heap.py \
 	Lib/multiprocessing/managers.py \
+	Lib/multiprocessing/pool.py \
 	Lib/multiprocessing/popen_fork.py \
 	Lib/multiprocessing/popen_forkserver.py \
 	Lib/multiprocessing/popen_spawn_posix.py \
@@ -733,7 +776,8 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/multiprocessing/queues.py \
 	Lib/multiprocessing/reduction.py \
 	Lib/multiprocessing/resource_sharer.py \
-	Lib/multiprocessing/semaphore_tracker.py \
+	Lib/multiprocessing/resource_tracker.py \
+	Lib/multiprocessing/shared_memory.py \
 	Lib/multiprocessing/sharedctypes.py \
 	Lib/multiprocessing/spawn.py \
 	Lib/multiprocessing/synchronize.py \
@@ -754,6 +798,7 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/unittest,\
 	Lib/unittest/__init__.py \
 	Lib/unittest/__main__.py \
+	Lib/unittest/async_case.py \
 	Lib/unittest/case.py \
 	Lib/unittest/loader.py \
 	Lib/unittest/main.py \
@@ -765,40 +810,6 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 	Lib/unittest/util.py \
 ))
 
-$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/unittest/test,\
-	Lib/unittest/test/__init__.py \
-	Lib/unittest/test/__main__.py \
-	Lib/unittest/test/_test_warnings.py \
-	Lib/unittest/test/dummy.py \
-	Lib/unittest/test/support.py \
-	Lib/unittest/test/test_assertions.py \
-	Lib/unittest/test/test_break.py \
-	Lib/unittest/test/test_case.py \
-	Lib/unittest/test/test_discovery.py \
-	Lib/unittest/test/test_functiontestcase.py \
-	Lib/unittest/test/test_loader.py \
-	Lib/unittest/test/test_program.py \
-	Lib/unittest/test/test_result.py \
-	Lib/unittest/test/test_runner.py \
-	Lib/unittest/test/test_setups.py \
-	Lib/unittest/test/test_skipping.py \
-	Lib/unittest/test/test_suite.py \
-))
-
-$(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/unittest/test/testmock,\
-	Lib/unittest/test/testmock/__init__.py \
-	Lib/unittest/test/testmock/__main__.py \
-	Lib/unittest/test/testmock/support.py \
-	Lib/unittest/test/testmock/testcallable.py \
-	Lib/unittest/test/testmock/testhelpers.py \
-	Lib/unittest/test/testmock/testmagicmethods.py \
-	Lib/unittest/test/testmock/testmock.py \
-	Lib/unittest/test/testmock/testpatch.py \
-	Lib/unittest/test/testmock/testsealable.py \
-	Lib/unittest/test/testmock/testsentinel.py \
-	Lib/unittest/test/testmock/testwith.py \
-))
-
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/urllib,\
 	Lib/urllib/__init__.py \
 	Lib/urllib/error.py \
@@ -823,21 +834,21 @@ $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/p
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/dom,\
 	Lib/xml/dom/__init__.py \
-	Lib/xml/dom/NodeFilter.py \
 	Lib/xml/dom/domreg.py \
 	Lib/xml/dom/expatbuilder.py \
 	Lib/xml/dom/minicompat.py \
 	Lib/xml/dom/minidom.py \
+	Lib/xml/dom/NodeFilter.py \
 	Lib/xml/dom/pulldom.py \
 	Lib/xml/dom/xmlbuilder.py \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/etree,\
 	Lib/xml/etree/__init__.py \
+	Lib/xml/etree/cElementTree.py \
 	Lib/xml/etree/ElementInclude.py \
 	Lib/xml/etree/ElementPath.py \
 	Lib/xml/etree/ElementTree.py \
-	Lib/xml/etree/cElementTree.py \
 ))
 
 $(eval $(call gb_ExternalPackage_add_unpacked_files,python3,$(LIBO_BIN_FOLDER)/python-core-$(PYTHON_VERSION)/lib/xml/parsers,\
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 3843eab915a3..b15e77839ceb 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -30,6 +30,12 @@ ifeq ($(OS),WNT)
 
 # TODO: using Debug configuration and related mangling of pyconfig.h
 
+gb_WIN_PLATFORM_MSBUILD := $(strip \
+	$(if $(filter INTEL,$(CPUNAME)),Win32) \
+	$(if $(filter X86_64,$(CPUNAME)),x64) \
+	$(if $(filter ARM64,$(CPUNAME)),arm64) \
+	)
+
 # at least for MSVC 2008 it is necessary to clear MAKEFLAGS because
 # nmake is invoked
 $(call gb_ExternalProject_get_state_target,python3,build) :
@@ -37,10 +43,12 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
 	$(call gb_ExternalProject_run,build,\
 		MAKEFLAGS= MSBuild.exe pcbuild.sln /t:Build \
 			/p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
-			/p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
+			/p:Platform=$(gb_WIN_PLATFORM_MSBUILD) \
 			/p:opensslIncludeDir=$(call gb_UnpackedTarball_get_dir,openssl)/include \
 			/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl) \
 			/p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
+			/p:libffiOutDir=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/.libs \
+			/p:libffiIncludeDir=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM)/include \
 			/maxcpucount \
 			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
 			$(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
diff --git a/external/python3/UnpackedTarball_python3.mk b/external/python3/UnpackedTarball_python3.mk
index d04868b93a44..94950537386c 100644
--- a/external/python3/UnpackedTarball_python3.mk
+++ b/external/python3/UnpackedTarball_python3.mk
@@ -20,7 +20,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,python3,\
 	external/python3/python-3.3.0-darwin.patch.1 \
 	external/python3/python-3.7.6-msvc-ssl.patch.1 \
 	external/python3/python-3.5.4-msvc-disable.patch.1 \
-	external/python3/python-3.3.0-clang.patch.1 \
 	external/python3/ubsan.patch.0 \
 	external/python3/python-3.5.tweak.strip.soabi.patch \
 	external/python3/darwin.patch.0 \
diff --git a/external/python3/internal-zlib.patch.0 b/external/python3/internal-zlib.patch.0
index abe2630bd2e7..de68d9e7dec8 100644
--- a/external/python3/internal-zlib.patch.0
+++ b/external/python3/internal-zlib.patch.0
@@ -23,7 +23,7 @@
          #
          # You can upgrade zlib to version 1.1.4 yourself by going to
          # http://www.gzip.org/zlib/
--        zlib_inc = find_file('zlib.h', [], inc_dirs)
+-        zlib_inc = find_file('zlib.h', [], self.inc_dirs)
 +        zlib_inc = [os.environ.get('ZLIB_INCDIR')]
          have_zlib = False
          if zlib_inc is not None:
@@ -32,16 +32,16 @@
                          version = line.split()[2]
                          break
              if version >= version_req:
--                if (self.compiler.find_library_file(lib_dirs, 'z')):
-+                if (self.compiler.find_library_file(lib_dirs, 'zlib')):
-                     if host_platform == "darwin":
+-                if (self.compiler.find_library_file(self.lib_dirs, 'z')):
++                if (self.compiler.find_library_file(self.lib_dirs, 'zlib')):
+                     if MACOS:
                          zlib_extra_link_args = ('-Wl,-search_paths_first',)
                      else:
                          zlib_extra_link_args = ()
-                     exts.append( Extension('zlib', ['zlibmodule.c'],
--                                           libraries = ['z'],
-+                                           libraries = ['zlib'],
-                                            extra_link_args = zlib_extra_link_args))
+                     self.add(Extension('zlib', ['zlibmodule.c'],
+-                                       libraries=['z'],
++                                       libraries=['zlib'],
+                                        extra_link_args=zlib_extra_link_args))
                      have_zlib = True
                  else:
 @@ -1399,7 +1399,7 @@
diff --git a/external/python3/python-3.3.0-clang.patch.1 b/external/python3/python-3.3.0-clang.patch.1
deleted file mode 100644
index 9001110fbed4..000000000000
--- a/external/python3/python-3.3.0-clang.patch.1
+++ /dev/null
@@ -1,13 +0,0 @@
--*- Mode: diff -*-
-
---- python3/setup.py
-+++ python3/setup.py
-@@ -436,7 +436,7 @@
-             if ret >> 8 == 0:
-                 with open(tmpfile) as fp:
-                     for line in fp.readlines():
--                        if line.startswith("gcc version"):
-+                        if line.startswith("gcc version") or line.startswith("clang -cc1 version"):
-                             is_gcc = True
-                         elif line.startswith("#include <...>"):
-                             in_incdirs = True
diff --git a/external/python3/python-3.3.0-darwin.patch.1 b/external/python3/python-3.3.0-darwin.patch.1
index d5cb17e339a2..ca88de393206 100644
--- a/external/python3/python-3.3.0-darwin.patch.1
+++ b/external/python3/python-3.3.0-darwin.patch.1
@@ -63,19 +63,3 @@ diff -ru python3.orig/Mac/Resources/framework/Info.plist.in python3/Mac/Resource
  	<key>CFBundleGetInfoString</key>
  	<string>Python Runtime and Library</string>
  	<key>CFBundleIdentifier</key>
-diff -ru python3.orig/setup.py python3/setup.py
---- python3.orig/setup.py	2015-07-26 17:36:11.804497783 +0200
-+++ python3/setup.py	2015-07-26 17:39:48.599512337 +0200
-@@ -468,11 +468,11 @@
-         # Ensure that /usr/local is always used, but the local build
-         # directories (i.e. '.' and 'Include') must be first.  See issue
-         # 10520.
--        if not cross_compiling:
-+        if not cross_compiling and host_platform != 'darwin':
-             add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
-             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
-         # only change this for cross builds for 3.3, issues on Mageia
--        if cross_compiling:
-+        if cross_compiling or host_platform == 'darwin':
-             self.add_gcc_paths()
-         self.add_multiarch_paths()
diff --git a/external/python3/python-3.5.4-msvc-disable.patch.1 b/external/python3/python-3.5.4-msvc-disable.patch.1
index 416ab2c7b15b..52c007d7d5b6 100644
--- a/external/python3/python-3.5.4-msvc-disable.patch.1
+++ b/external/python3/python-3.5.4-msvc-disable.patch.1
@@ -12,7 +12,7 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winsound", "winsound.vcxproj", "{28B5D777-DDF2-4B6B-B34F-31D938813856}"
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_decimal", "_decimal.vcxproj", "{0E9791DB-593A-465F-98BC-681011311617}"
-@@ -28,32 +26,18 @@
+@@ -28,34 +26,20 @@
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_socket", "_socket.vcxproj", "{86937F53-C189-40EF-8CE8-8759D8E7D480}"
  EndProject
@@ -22,6 +22,8 @@ diff -ru python3.orig/PCbuild/pcbuild.sln python3/PCbuild/pcbuild.sln
  EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcxproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}"
  EndProject
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testinternalcapi", "_testinternalcapi.vcxproj", "{900342D7-516A-4469-B1AD-59A66E49A25F}"
+ EndProject
  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testimportmultiple", "_testimportmultiple.vcxproj", "{36D0C52C-DF4E-45D0-8BC7-E294C3ABC781}"
  EndProject
 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_tkinter", "_tkinter.vcxproj", "{4946ECAC-2E69-4BF8-A90A-F5136F5094DF}"
commit 0d4e71077928d8fa4d07ec1fad8795f2295b49bc
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Jul 8 03:01:41 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Jul 8 10:12:58 2020 +0200

    libffi: build DLL on Windows
    
    The build setup is rather horrible, with some minimal gcc MSVC
    wrapper. But the DLL is a prerequisite for the Python 3.8 build,
    which dropped the internal libffi.
    
    There is supposed to be a separate static Windows Arm64 build in
    the msvc_build/aarch64 folder, but the DLL builds too, so this
    just uses it for the moment.
    
    This also defaults to explicit --buid and --host settings, even
    without a cross build, because the prediced name would otherwise
    differ (*-unknown-cygwin instead of *-pc-cygwin).
    
    Additionally a "make install" also fails...
    
    Change-Id: Ifb7dac840e23efffb9a5e342560aef9e11e0db79

diff --git a/configure.ac b/configure.ac
index 63b15e47a715..66e33cc61ad7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4937,6 +4937,7 @@ if test "$cross_compiling" = "yes"; then
         HARFBUZZ
         ICU
         LCMS2
+        LIBFFI
         LIBJPEG_TURBO
         LIBLANGTAG
         LibO
@@ -9099,7 +9100,7 @@ internal)
     fi
     AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
     BUILD_TYPE="$BUILD_TYPE PYTHON"
-    if test "$OS" = LINUX; then
+    if test "$OS" = LINUX -o "$OS" = WNT ; then
         BUILD_TYPE="$BUILD_TYPE LIBFFI"
     fi
     # Embedded Python dies without Home set
diff --git a/external/libffi/ExternalProject_libffi.mk b/external/libffi/ExternalProject_libffi.mk
index 13a4b18db13d..b6cfc590483b 100644
--- a/external/libffi/ExternalProject_libffi.mk
+++ b/external/libffi/ExternalProject_libffi.mk
@@ -15,17 +15,32 @@ $(eval $(call gb_ExternalProject_register_targets,libffi,\
 
 # set prefix so that it ends up in libffi.pc so that pkg-config in python3 works
 
+gb_WIN_PLATFORM := $(strip \
+    $(if $(filter INTEL,$(CPUNAME)),32) \
+    $(if $(filter X86_64,$(CPUNAME)),64) \
+    $(if $(filter ARM64,$(CPUNAME)),arm64) \
+    )
+
 $(call gb_ExternalProject_get_state_target,libffi,build):
 	$(call gb_Trace_StartRange,libffi,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
+		export LIB="$(ILIB)" && \
 		./configure \
 			--enable-option-checking=fatal \
-			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
-			--enable-static \
-			--disable-shared \
-			--with-pic \
-			--enable-portable-binary \
-			CC="$(CC) $(if $(filter LINUX,$(OS)),-fvisibility=hidden)" \
+			--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+			$(if $(filter LINUX,$(OS)), \
+			    --disable-shared \
+			    CC="$(CC) -fvisibility=hidden" \
+				--with-pic \
+				--enable-portable-binary) \
+			$(if $(filter WNT,$(OS)), \
+			    --disable-static \
+			    CC="$(call gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(gb_WIN_PLATFORM)" \
+			    CXX="$(call gb_UnpackedTarball_get_dir,libffi)/msvcc.sh -m$(gb_WIN_PLATFORM)" \
+				LD='link' \
+				CPP='cl -nologo -EP' \
+				CXXCPP='cl -nologo -EP' \
+				CPPFLAGS="-DFFI_BUILDING_DLL $(SOLARINC)") \
 			--prefix=$(call gb_UnpackedTarball_get_dir,libffi)/$(HOST_PLATFORM) \
 			--disable-docs \
 		&& $(MAKE) \
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index e3096b14fed7..3843eab915a3 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -11,7 +11,7 @@ $(eval $(call gb_ExternalProject_ExternalProject,python3))
 
 $(eval $(call gb_ExternalProject_use_externals,python3,\
 	expat \
-	$(if $(filter LINUX,$(OS)),libffi) \
+	$(if $(filter WNT LINUX,$(OS)),libffi) \
 	openssl \
 	zlib \
 ))
commit 661bac9efcd26936d365bf40dddd048f90eae362
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Jul 7 18:39:44 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Jul 8 10:11:56 2020 +0200

    openssl: update to supported 1.1.1 release
    
    This already has Windows Arm64 support.
    
    Change-Id: I61d94f966bc59407f213f4a81f0a49d0c05f8948

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 7b305e6d7ae2..522dfd4fe282 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1592,8 +1592,8 @@ define gb_LinkTarget__use_openssl
 $(call gb_LinkTarget_use_package,$(1),openssl)
 ifeq ($(OS),WNT)
 $(call gb_LinkTarget_add_libs,$(1),\
-	$(call gb_UnpackedTarball_get_dir,openssl)/out32dll/ssleay32.lib \
-	$(call gb_UnpackedTarball_get_dir,openssl)/out32dll/libeay32.lib \
+	$(call gb_UnpackedTarball_get_dir,openssl)/libcrypto.lib \
+	$(call gb_UnpackedTarball_get_dir,openssl)/libssl.lib \
 )
 else
 $(call gb_LinkTarget_add_libs,$(1),\
diff --git a/download.lst b/download.lst
index b14494e4663a..6c684aceac6f 100644
--- a/download.lst
+++ b/download.lst
@@ -205,8 +205,8 @@ export OFFICEOTRON_JAR := 8249374c274932a21846fa7629c2aa9b-officeotron-0.7.4-mas
 export OPENLDAP_SHA256SUM := cdd6cffdebcd95161a73305ec13fc7a78e9707b46ca9f84fb897cd5626df3824
 export OPENLDAP_TARBALL := openldap-2.4.45.tgz
 export OPENSSL_SHA256SUM := 14cb464efe7ac6b54799b34456bd69558a749a4931ecfd9cf9f71d7881cac7bc
-export OPENSSL_TARBALL := openssl-1.0.2t.tar.gz
-export ORCUS_SHA256SUM := cfb2aa60825f2a78589ed030c07f46a1ee16ef8a2d1bf2279192fbc1ae5a5f61
+export OPENSSL_TARBALL := openssl-1.1.1g.tar.gz
+export ORCUS_SHA256SUM := ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
 export ORCUS_TARBALL := liborcus-0.15.4.tar.bz2
 export OWNCLOUD_ANDROID_LIB_SHA256SUM := b18b3e3ef7fae6a79b62f2bb43cc47a5346b6330f6a383dc4be34439aca5e9fb
 export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-deps.tar.gz
diff --git a/external/openssl/ExternalPackage_openssl.mk b/external/openssl/ExternalPackage_openssl.mk
index 695c7b7119b6..de77f53f33b9 100644
--- a/external/openssl/ExternalPackage_openssl.mk
+++ b/external/openssl/ExternalPackage_openssl.mk
@@ -13,8 +13,8 @@ $(eval $(call gb_ExternalPackage_use_external_project,openssl,openssl))
 
 ifeq ($(COM),MSC)
 $(eval $(call gb_ExternalPackage_add_files,openssl,$(LIBO_LIB_FOLDER),\
-	out32dll/ssleay32.dll \
-	out32dll/libeay32.dll \
+    libcrypto-1_1.dll \
+    libssl-1_1.dll \
 ))
 endif
 
diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk
index 6645cab4bc4a..e9f857c2f0e8 100644
--- a/external/openssl/ExternalProject_openssl.mk
+++ b/external/openssl/ExternalProject_openssl.mk
@@ -42,7 +42,9 @@ OPENSSL_PLATFORM := \
         ios-aarch64\
       ,\
         $(if $(filter WNT,$(OS)),\
-          $(if $(filter INTEL,$(CPUNAME)),VC-WIN32,VC-WIN64A)\
+          $(if $(filter INTEL,$(CPUNAME)),VC-WIN32)\
+          $(if $(filter X86_64,$(CPUNAME)),VC-WIN64A)\
+          $(if $(filter ARM64,$(CPUNAME)),VC-WIN64-ARM)\
         ,\
           $(if $(filter MACOSX,$(OS)),\
             $(if $(filter X86_64,$(CPUNAME)),darwin64-x86_64-cc)\
@@ -59,11 +61,9 @@ $(eval $(call gb_ExternalProject_use_nmake,openssl,build))
 $(call gb_ExternalProject_get_state_target,openssl,build):
 	$(call gb_Trace_StartRange,openssl,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		export PERL="$(shell cygpath -w $(PERL))" \
-		&& $(PERL) Configure $(OPENSSL_PLATFORM) no-idea \
-		&& cmd /c "ms\do_ms.bat $(PERL) $(OPENSSL_PLATFORM)" \
-		&& nmake -f "ms\ntdll.mak" \
-		&& mv inc32/* include/ \
+		CONFIGURE_INSIST=1 $(PERL) Configure $(OPENSSL_PLATFORM) no-tests no-multilib \
+		&& export PERL="$(shell cygpath -w $(PERL))" \
+		&& nmake -f makefile \
 	)
 	$(call gb_Trace_EndRange,openssl,EXTERNAL)
 
@@ -77,8 +77,7 @@ $(call gb_ExternalProject_get_state_target,openssl,build):
 		$(if $(filter WNT,$(OS)), \
 			$(PERL) Configure, \
 			./config)) \
-			$(OPENSSL_PLATFORM) no-dso no-shared \
-			$(if $(filter-out WNT,$(OS)),no-idea) \
+			$(OPENSSL_PLATFORM) no-dso no-shared no-tests no-multilib \
 			$(if $(filter-out ANDROID iOS WNT,$(OS)), \
 				$(if $(SYSBASE),-I$(SYSBASE)/usr/include -L$(SYSBASE)/usr/lib)) \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
diff --git a/external/openssl/UnpackedTarball_openssl.mk b/external/openssl/UnpackedTarball_openssl.mk
index ca0587272fcc..6f00cf7f7e44 100644
--- a/external/openssl/UnpackedTarball_openssl.mk
+++ b/external/openssl/UnpackedTarball_openssl.mk
@@ -12,15 +12,7 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,openssl))
 $(eval $(call gb_UnpackedTarball_set_tarball,openssl,$(OPENSSL_TARBALL),,openssl))
 
 $(eval $(call gb_UnpackedTarball_add_patches,openssl,\
-	external/openssl/openssllnx.patch \
-	external/openssl/opensslwnt.patch \
-	$(if $(filter INTEL,$(CPUNAME)),external/openssl/opensslwnt_safeseh.patch) \
-	external/openssl/openssl-1.0.1h-win64.patch.1 \
-	external/openssl/opensslsol.patch \
-	external/openssl/opensslios.patch \
-	external/openssl/openssl-3650-masm.patch.1 \
-	external/openssl/openssl-fixbuild.patch.1 \
-	external/openssl/openssl-macos-arm64.patch.1 \
+	external/openssl/openssl-no-multilib.patch.0 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/openssl/openssl-1.0.1h-win64.patch.1 b/external/openssl/openssl-1.0.1h-win64.patch.1
deleted file mode 100644
index aea914633ebb..000000000000
--- a/external/openssl/openssl-1.0.1h-win64.patch.1
+++ /dev/null
@@ -1,47 +0,0 @@
-diff --git a/ms/do_win64a.bat b/ms/do_win64a.bat
-index 8768dc6..6772390 100755
---- a/ms/do_win64a.bat
-+++ b/ms/do_win64a.bat
-@@ -1,19 +1,19 @@
--perl util\mkfiles.pl >MINFO
-+perl util/mkfiles.pl >MINFO
- 
- cmd /c "nasm -f win64 -v" >NUL 2>&1
- if %errorlevel% neq 0 goto ml64
- 
--perl ms\uplink-x86_64.pl nasm > ms\uptable.asm
--nasm -f win64 -o ms\uptable.obj ms\uptable.asm
-+perl ms/uplink-x86_64.pl nasm > ms/uptable.asm
-+nasm -f win64 -o ms/uptable.obj ms/uptable.asm
- goto proceed
- 
- :ml64
--perl ms\uplink-x86_64.pl masm > ms\uptable.asm
--ml64 -c -Foms\uptable.obj ms\uptable.asm
-+perl ms/uplink-x86_64.pl masm > ms/uptable.asm
-+ml64 -c -Foms/uptable.obj ms/uptable.asm
- 
- :proceed
--perl util\mk1mf.pl VC-WIN64A >ms\nt.mak
--perl util\mk1mf.pl dll VC-WIN64A >ms\ntdll.mak
-+perl util/mk1mf.pl VC-WIN64A >ms/nt.mak
-+perl util/mk1mf.pl dll VC-WIN64A >ms/ntdll.mak
- 
--perl util\mkdef.pl 32 libeay > ms\libeay32.def
--perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
-+perl util/mkdef.pl 32 libeay > ms/libeay32.def
-+perl util/mkdef.pl 32 ssleay > ms/ssleay32.def
-diff --git a/util/mk1mf.pl b/util/mk1mf.pl
-index 72fa089..d98def1 100755
---- a/util/mk1mf.pl
-+++ b/util/mk1mf.pl
-@@ -233,6 +233,9 @@ else
- 	$cflags.=' -DTERMIO';
- 	}
- 
-+# force unix style path separator
-+${o} = "/";
-+
- $fipsdir =~ s/\//${o}/g;
- 
- $out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:$out_def.($debug?".dbg":"");
diff --git a/external/openssl/openssl-3650-masm.patch.1 b/external/openssl/openssl-3650-masm.patch.1
deleted file mode 100644
index 97f1eb6446c3..000000000000
--- a/external/openssl/openssl-3650-masm.patch.1
+++ /dev/null
@@ -1,35 +0,0 @@
-diff --git a/crypto/perlasm/x86masm.pl b/crypto/perlasm/x86masm.pl
-index 1741342..917d0f8 100644
---- a/crypto/perlasm/x86masm.pl
-+++ b/crypto/perlasm/x86masm.pl
-@@ -18,10 +18,10 @@ sub ::generic
- 
-     if ($opcode =~ /lea/ && @arg[1] =~ s/.*PTR\s+(\(.*\))$/OFFSET $1/)	# no []
-     {	$opcode="mov";	}
--    elsif ($opcode !~ /movq/)
-+    elsif ($opcode !~ /mov[dq]$/)
-     {	# fix xmm references
--	$arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[1]=~/\bxmm[0-7]\b/i);
--	$arg[1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
-+	$arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[-1]=~/\bxmm[0-7]\b/i);
-+	$arg[-1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
-     }
- 
-     &::emit($opcode, at arg);
-@@ -160,13 +160,13 @@ sub ::public_label
- {   push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n");   }
- 
- sub ::data_byte
--{   push(@out,("DB\t").join(',', at _)."\n");	}
-+{   push(@out,("DB\t").join(',',splice(@_,0,16))."\n") while(@_);	}
- 
- sub ::data_short
--{   push(@out,("DW\t").join(',', at _)."\n");	}
-+{   push(@out,("DW\t").join(',',splice(@_,0,8))."\n") while(@_);	}
- 
- sub ::data_word
--{   push(@out,("DD\t").join(',', at _)."\n");	}
-+{   push(@out,("DD\t").join(',',splice(@_,0,4))."\n") while(@_);	}
- 
- sub ::align
- {   push(@out,"ALIGN\t$_[0]\n");	}
diff --git a/external/openssl/openssl-fixbuild.patch.1 b/external/openssl/openssl-fixbuild.patch.1
deleted file mode 100644
index 5a986e87214b..000000000000
--- a/external/openssl/openssl-fixbuild.patch.1
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/crypto/evp/Makefile
-+++ b/crypto/evp/Makefile
-@@ -289,7 +289,7 @@
- e_idea.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
- e_idea.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
- e_idea.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
--e_idea.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
-+e_idea.o: ../../include/openssl/evp.h ../idea/idea.h
- e_idea.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
- e_idea.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
- e_idea.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
---- a/util/mklink.pl
-+++ b/util/mklink.pl
-@@ -50,8 +50,7 @@
- my $to = join('/', @to_path);
- 
- my $file;
--$symlink_exists=eval {symlink("",""); 1};
--if ($^O eq "msys") { $symlink_exists=0 };
-+$symlink_exists=0;
- foreach $file (@files) {
-     my $err = "";
-     if ($symlink_exists) {
diff --git a/external/openssl/openssl-macos-arm64.patch.1 b/external/openssl/openssl-macos-arm64.patch.1
deleted file mode 100644
index f0be9dbab760..000000000000
--- a/external/openssl/openssl-macos-arm64.patch.1
+++ /dev/null
@@ -1,13 +0,0 @@
--*- Mode: diff -*-
-
---- a/Configure
-+++ b/Configure
-@@ -620,6 +620,8 @@
- "debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
- "darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
- "debug-darwin64-x86_64-cc","cc:-arch x86_64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-+"darwin64-arm64-cc","cc:-arch arm64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
-+"debug-darwin64-arm64-cc","cc:-arch arm64 -ggdb -g2 -O0 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
- "debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
- # iPhoneOS/iOS
- "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
diff --git a/external/openssl/openssl-no-multilib.patch.0 b/external/openssl/openssl-no-multilib.patch.0
new file mode 100644
index 000000000000..07c45318ac25
--- /dev/null
+++ b/external/openssl/openssl-no-multilib.patch.0
@@ -0,0 +1,38 @@
+--- Configure.orig	2020-04-21 14:22:39.000000000 +0200
++++ Configure	2020-07-07 17:25:19.256297500 +0200
+@@ -24,7 +24,7 @@
+ my $orig_death_handler = $SIG{__DIE__};
+ $SIG{__DIE__} = \&death_handler;
+ 
+-my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
++my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [no-multilib] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
+ 
+ # Options:
+ #
+@@ -59,6 +59,7 @@
+ #               If disabled, it also disables shared and dynamic-engine.
+ # no-asm        do not use assembler
+ # no-egd        do not compile support for the entropy-gathering daemon APIs
++# no-multilib   exclude multilib identifier from library name
+ # [no-]zlib     [don't] compile support for zlib compression.
+ # zlib-dynamic  Like "zlib", but the zlib library is expected to be a shared
+ #               library and will be loaded in run-time by the OpenSSL library.
+@@ -383,6 +384,7 @@
+     "mdc2",
+     "msan",
+     "multiblock",
++    "multilib",
+     "nextprotoneg",
+     "pinshared",
+     "ocb",
+@@ -1754,6 +1756,10 @@
+             if (-f catfile($srcdir, "test", $_, "build.info"));
+     }
+ 
++    if ($disabled{"multilib"}) {
++        $target{"multilib"} = "";
++    }
++
+     $config{build_infos} = [ ];
+ 
+     my %ordinals = ();
diff --git a/external/openssl/openssllnx.patch b/external/openssl/openssllnx.patch
deleted file mode 100644
index 224df8f87b2e..000000000000
--- a/external/openssl/openssllnx.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- build/openssl-0.9.8v/Configure-old	2010-04-17 13:51:42.000000000 +0200
-+++ build/openssl-0.9.8v/Configure	2010-04-17 13:52:03.000000000 +0200
-@@ -388,6 +388,9 @@
- 
- "bsdi-elf-gcc",     "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
- 
-+"debian-kfreebsd-amd64","gcc:-m64 -DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+"debian-kfreebsd-i386","gcc:-DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
-+
- "nextstep",	"cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
- "nextstep3.3",	"cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
- 
---- build/openssl-0.9.8v/Makefile.org	2010-01-27 17:06:36.000000000 +0100
-+++ build/openssl-0.9.8v/Makefile.org	2010-09-20 09:24:00.000000000 +0100
-@@ -206,7 +206,7 @@
- # same language for uniform treatment.
- BUILDENV=	LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
- 		CC='$(CC)' CFLAG='$(CFLAG)' 			\
--		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
-+		AS='$(CC)' ASFLAG='$(CFLAG) -c -Wa,--noexecstack'       \
- 		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
- 		RC='$(RC)'              			\
- 		CROSS_COMPILE='$(CROSS_COMPILE)'	\
diff --git a/external/openssl/opensslsol.patch b/external/openssl/opensslsol.patch
deleted file mode 100644
index 6122b67c930e..000000000000
--- a/external/openssl/opensslsol.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- misc/openssl-0.9.8v/Makefile.shared	Wed Sep 17 17:56:40 2008
-+++ build/openssl-0.9.8v/Makefile.shared	Fri Mar 26 16:04:41 2010
-@@ -95,7 +95,7 @@
-     LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
-     LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
-     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
--    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
-+    LD_LIBRARY_PATH=$$LD_LIBRARY_PATH \
-     $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
- 
- LINK_SO=	\
-@@ -105,7 +105,7 @@
-     SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
-     LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
-     LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
--    LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
-+    LD_LIBRARY_PATH=$$LD_LIBRARY_PATH \
-     $${SHAREDCMD} $${SHAREDFLAGS} \
- 	-o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
- 	$$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
diff --git a/external/openssl/opensslwnt.patch b/external/openssl/opensslwnt.patch
deleted file mode 100644
index e22bea6f077b..000000000000
--- a/external/openssl/opensslwnt.patch
+++ /dev/null
@@ -1,167 +0,0 @@
-diff -ru openssl.orig/crypto/x509v3/v3_pci.c openssl/crypto/x509v3/v3_pci.c
---- a/openssl.orig/crypto/x509v3/v3_pci.c	2016-03-01 14:35:05.000000000 +0100
-+++ b/openssl/crypto/x509v3/v3_pci.c	2016-03-03 20:27:42.195914432 +0100
-@@ -3,7 +3,7 @@
-  * Contributed to the OpenSSL Project 2004 by Richard Levitte
-  * (richard at levitte.org)
-  */
--/* Copyright (c) 2004 Kungliga Tekniska Högskolan
-+/* Copyright (c) 2004 Kungliga Tekniska Hoegskolan
-  * (Royal Institute of Technology, Stockholm, Sweden).
-  * All rights reserved.
-  *
-diff -ru openssl.orig/crypto/x509v3/v3_pcia.c openssl/crypto/x509v3/v3_pcia.c
---- a/openssl.orig/crypto/x509v3/v3_pcia.c	2016-03-01 14:35:05.000000000 +0100
-+++ b/openssl/crypto/x509v3/v3_pcia.c	2016-03-03 20:27:56.495913984 +0100
-@@ -3,7 +3,7 @@
-  * Contributed to the OpenSSL Project 2004 by Richard Levitte
-  * (richard at levitte.org)
-  */
--/* Copyright (c) 2004 Kungliga Tekniska Högskolan
-+/* Copyright (c) 2004 Kungliga Tekniska Hoegskolan
-  * (Royal Institute of Technology, Stockholm, Sweden).
-  * All rights reserved.
-  *
-diff -ru openssl.orig/ms/do_ms.bat openssl/ms/do_ms.bat
---- a/openssl.orig/ms/do_ms.bat	2015-01-15 15:43:14.000000000 +0100
-+++ b/openssl/ms/do_ms.bat	2016-03-03 20:31:09.355907935 +0100
-@@ -1,11 +1,11 @@
- 
--perl util\mkfiles.pl >MINFO
--perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
--perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak
--if x%OSVERSION% == x goto skipce
--perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak
--perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak
--:skipce
-+%1 util\mkfiles.pl >MINFO
-+if %2 == VC-WIN32 goto not64a
-+perl ms\uplink.pl win64a > ms\uptable.asm
-+ml64 -c -Foms\uptable.obj ms\uptable.asm
-+:not64a
-+%1 util\mk1mf.pl no-asm %2 >ms\nt.mak
-+%1 util\mk1mf.pl dll no-asm %2 >ms\ntdll.mak
- 
--perl util\mkdef.pl 32 libeay > ms\libeay32.def
--perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
-+%1 util\mkdef.pl 32 libeay > ms\libeay32.def
-+%1 util\mkdef.pl 32 ssleay > ms\ssleay32.def
-diff -ru openssl.orig/util/mk1mf.pl openssl/util/mk1mf.pl
---- a/openssl.orig/util/mk1mf.pl	2016-03-03 20:22:21.043924505 +0100
-+++ b/openssl/util/mk1mf.pl	2016-03-03 20:34:45.015901171 +0100
-@@ -163,7 +163,7 @@
- $inc_def="outinc";
- $tmp_def="tmp";
- 
--$perl="perl" unless defined $perl;
-+$perl="$ENV{PERL}" unless defined $perl;
- $mkdir="-mkdir" unless defined $mkdir;
- 
- ($ssl,$crypto)=("ssl","crypto");
-@@ -347,6 +347,11 @@
- 	s/\s*$//; # was chop, didn't work in mixture of perls for Windows...
- 
- 	($key,$val)=/^([^=]+)=(.*)/;
-+
-+	# On some Windows machines, $val has linefeeds at the end, which confuses
-+	# subsequent code in this file. So we strip all whitespace at the end.
-+	$val =~ s/\s+$//;
-+
- 	if ($key eq "RELATIVE_DIRECTORY")
- 		{
- 		if ($lib ne "")
-@@ -473,7 +478,7 @@
- # Set your compiler options
- PLATFORM=$platform
- CC=$bin_dir${cc}
--CFLAG=$cflags
-+CFLAG=$cflags \$(SOLARINC)
- APP_CFLAG=$app_cflag
- LIB_CFLAG=$lib_cflag
- SHLIB_CFLAG=$shl_cflag
-@@ -488,7 +493,7 @@
- 
- LINK_CMD=$link
- LFLAGS=$lflags
--RSC=$rsc
-+RSC=$rsc \$(SOLARINC)
- 
- # The output directory for everything interesting
- OUT_D=$out_dir
-@@ -669,7 +674,7 @@
- printf OUT <<EOF;
- #ifdef $platform_cpp_symbol
-   /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
--  #define CFLAGS "compiler: $cc $cflags"
-+  #define CFLAGS "compiler: $cflags"
-   #define PLATFORM "$platform"
- EOF
- printf OUT "  #define DATE \"%s\"\n", scalar gmtime();
-diff -ru openssl.orig/util/pl/VC-32.pl openssl/util/pl/VC-32.pl
---- a/openssl.orig/util/pl/VC-32.pl	2016-03-01 14:35:53.000000000 +0100
-+++ b/openssl/util/pl/VC-32.pl	2016-03-03 21:15:14.083824986 +0100
-@@ -30,7 +30,7 @@
- my $ff = "";
- 
- # C compiler stuff
--$cc='cl';
-+$cc=$ENV{'CC'};
- if ($FLAVOR =~ /WIN64/)
-     {
-     # Note that we currently don't have /WX on Win64! There is a lot of
-@@ -114,7 +114,7 @@
-     }
- 
-     $cc=($ENV{CC} or "cl");
--    $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
-+    $base_cflags=' -W3 -GF -Gy -nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
-     $base_cflags.=" $wcecdefs";
-     $base_cflags.=' -I$(WCECOMPAT)/include'		if (defined($ENV{'WCECOMPAT'}));
-     $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include'	if (defined($ENV{'PORTSDK_LIBPATH'}));
-@@ -123,20 +123,21 @@
-     } else {
- 	$base_cflags.=' /MC';
-     }
--    $opt_cflags=' /O1i';	# optimize for space, but with intrinsics...
--    $dbg_cflags=' /Od -DDEBUG -D_DEBUG';
-+    $opt_cflags=' -O1i';   # optimize for space, but with intrinsics...
-+    $dbg_cflags=' -Od -DDEBUG -D_DEBUG';
-+
-     $lflags="/nologo /opt:ref $wcelflag";
-     }
- else	# Win32
-     {
-     $base_cflags= " $mf_cflag";
--    my $f = $shlib || $fips ?' /MD':' /MT';
-+    my $f = $shlib || $fips ? (($ENV{MSVC_USE_DEBUG_RUNTIME} eq "TRUE") ? ' -MDd' : ' -MD' ):' -MT';
-     $ff = "/fixed";
--    $opt_cflags=$f.' /Ox /O2 /Ob2';
--    $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
-+    $opt_cflags=$f.' -Ox -O2 -Ob2';
-+    $dbg_cflags=$f.'d -Od -DDEBUG -D_DEBUG';
-     $lflags="/nologo /subsystem:console /opt:ref";
-     }
--$lib_cflag='/Zl' if (!$shlib);	# remove /DEFAULTLIBs from static lib
-+$lib_cflag='-Zl' if (!$shlib);	# remove /DEFAULTLIBs from static lib
- $mlflags='';
- 
- $out_def ="out32";	$out_def.="dll"			if ($shlib);
-@@ -161,7 +162,7 @@
- 
- $obj='.obj';
- $asm_suffix='.asm';
--$ofile="/Fo";
-+$ofile="-Fo.\\";
- 
- # EXE linking stuff
- $link="link";
-diff -ru openssl.orig/ms/uplink.c openssl/ms/uplink.c
---- a/openssl.orig/ms/uplink.c	2015-03-19 15:02:02.000000000 +0100
-+++ b/openssl/ms/uplink.c	2016-03-03 20:39:19.403892565 +0100
-@@ -1,5 +1,6 @@
- #if (defined(_WIN64) || defined(_WIN32_WCE)) && !defined(UNICODE)
- # define UNICODE
-+# define _CRT_NON_CONFORMING_SWPRINTFS
- #endif
- #if defined(UNICODE) && !defined(_UNICODE)
- # define _UNICODE
diff --git a/external/openssl/opensslwnt_safeseh.patch b/external/openssl/opensslwnt_safeseh.patch
deleted file mode 100644
index f2eafab5b9ed..000000000000
--- a/external/openssl/opensslwnt_safeseh.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-use /safeseh in 32-bit MSVC builds; this is not required for 64-bit
-
-diff -ru openssl.orig/util/mk1mf.pl openssl/util/mk1mf.pl
---- a/openssl.orig/util/mk1mf.pl	2016-03-03 20:22:21.043924505 +0100
-+++ b/openssl/util/mk1mf.pl	2016-03-03 20:34:45.015901171 +0100
-@@ -488,7 +493,7 @@
- SRC_D=$src_dir
- 
- LINK_CMD=$link
--LFLAGS=$lflags
-+LFLAGS=$lflags /SAFESEH
- RSC=$rsc \$(SOLARINC)
- 
- # The output directory for everything interesting
-@@ -511,7 +516,7 @@
- MKDIR=$mkdir
- MKLIB=$bin_dir$mklib
- MLFLAGS=$mlflags
--ASM=$bin_dir$asm
-+ASM=$bin_dir$asm /safeseh
- 
- # FIPS validated module and support file locations
- 
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 91c6c1948c95..e3096b14fed7 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -39,7 +39,7 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
 			/p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
 			/p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
 			/p:opensslIncludeDir=$(call gb_UnpackedTarball_get_dir,openssl)/include \
-			/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl)/out32dll \
+			/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl) \
 			/p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
 			/maxcpucount \
 			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
diff --git a/external/python3/python-3.7.6-msvc-ssl.patch.1 b/external/python3/python-3.7.6-msvc-ssl.patch.1
index e8e94f674c1f..34056831a2c0 100644
--- a/external/python3/python-3.7.6-msvc-ssl.patch.1
+++ b/external/python3/python-3.7.6-msvc-ssl.patch.1
@@ -14,27 +14,12 @@ No use for applink.c OPENSSL_Applink, everything is compiled with the same MSVC
      <ResourceCompile Include="..\PC\python_nt.rc" />
 --- python3/PCbuild/openssl.props.orig	2019-12-23 16:20:34.588135900 +0100
 +++ python3/PCbuild/openssl.props	2019-12-23 16:20:51.074001300 +0100
-@@ -6,7 +6,7 @@
-     </ClCompile>
-     <Link>
-       <AdditionalLibraryDirectories>$(opensslOutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
--      <AdditionalDependencies>ws2_32.lib;libcrypto.lib;libssl.lib;%(AdditionalDependencies)</AdditionalDependencies>
-+      <AdditionalDependencies>ws2_32.lib;libeay32.lib;ssleay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
-     </Link>
+@@ -11,8 +11,6 @@
    </ItemDefinitionGroup>
    <PropertyGroup>
-@@ -15,10 +15,10 @@
-     <_DLLSuffix Condition="$(Platform) == 'ARM64'">$(_DLLSuffix)-arm64</_DLLSuffix>
+     <_DLLSuffix>-1_1</_DLLSuffix>
+-    <_DLLSuffix Condition="$(Platform) == 'ARM'">$(_DLLSuffix)-arm</_DLLSuffix>
+-    <_DLLSuffix Condition="$(Platform) == 'ARM64'">$(_DLLSuffix)-arm64</_DLLSuffix>
    </PropertyGroup>
    <ItemGroup>
--    <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
--    <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).pdb" />
--    <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).dll" />
--    <_SSLDLL Include="$(opensslOutDir)\libssl$(_DLLSuffix).pdb" />
-+    <_SSLDLL Include="$(opensslOutDir)\libeay32.dll" />
-+    <_SSLDLL Include="$(opensslOutDir)\libeay32.pdb" />
-+    <_SSLDLL Include="$(opensslOutDir)\ssleay32.dll" />
-+    <_SSLDLL Include="$(opensslOutDir)\ssleay32.pdb" />
-   </ItemGroup>
-   <Target Name="_CopySSLDLL" Inputs="@(_SSLDLL)" Outputs="@(_SSLDLL->'$(OutDir)%(Filename)%(Extension)')" AfterTargets="Build">
-     <Copy SourceFiles="@(_SSLDLL)" DestinationFolder="$(OutDir)" />
+     <_SSLDLL Include="$(opensslOutDir)\libcrypto$(_DLLSuffix).dll" />
commit 5104b369ef90ae44f0a341b4728d7595b199008e
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Jul 7 18:40:54 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Jul 8 06:51:00 2020 +0200

    icu: fix Windows Arm64 cross build
    
    I'm not sure the patch is correct, but it WFM.
    
    Change-Id: I6e53e1531048404b70dcf61eab0a7f4021076868

diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 4762c86908b9..0e5c93070796 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -17,19 +17,21 @@ icu_CPPFLAGS:="-DHAVE_GCC_ATOMICS=$(if $(filter TRUE,$(GCC_HAVE_BUILTIN_ATOMIC))
 
 ifeq ($(OS),WNT)
 
-# Note: runConfigureICU ignores everything following the platform name!
 $(call gb_ExternalProject_get_state_target,icu,build) :
 	$(call gb_Trace_StartRange,icu,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
-		export LIB="$(ILIB)" \
+	    autoconf \
+		&& export LIB="$(ILIB)" \
 		&& CFLAGS="-FS $(SOLARINC) $(gb_DEBUGINFO_FLAGS)" CPPFLAGS="$(SOLARINC)" CXXFLAGS="-FS $(SOLARINC) $(gb_DEBUGINFO_FLAGS)" \
 			INSTALL=`cygpath -m /usr/bin/install` \
 			./configure \
-			$(if $(MSVC_USE_DEBUG_RUNTIME),--enable-debug --disable-release) \
-			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
-                --with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source) \
-			--disable-extras \
+				$(if $(MSVC_USE_DEBUG_RUNTIME),--enable-debug --disable-release) \
+				$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+					--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source \
+				    $(if $(GNUMAKE_WIN_NATIVE),--enable-native-make)) \
+				--disable-extras \
 		&& $(MAKE) $(if $(CROSS_COMPILING),DATASUBDIR=data) \
+		    $(if $(verbose),VERBOSE=1) \
 	,source)
 	$(call gb_Trace_EndRange,icu,EXTERNAL)
 
@@ -65,6 +67,7 @@ icu_LDFLAGS:=" \
 $(call gb_ExternalProject_get_state_target,icu,build) :
 	$(call gb_Trace_StartRange,icu,EXTERNAL)
 	$(call gb_ExternalProject_run,build,\
+		autoconf && \
 		CPPFLAGS=$(icu_CPPFLAGS) CFLAGS=$(icu_CFLAGS) \
 		CXXFLAGS=$(icu_CXXFLAGS) LDFLAGS=$(icu_LDFLAGS) \
 		./configure \
diff --git a/external/icu/UnpackedTarball_icu.mk b/external/icu/UnpackedTarball_icu.mk
index 72fae09b1625..6bc227d734d5 100644
--- a/external/icu/UnpackedTarball_icu.mk
+++ b/external/icu/UnpackedTarball_icu.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,icu,\
 	external/icu/ubsan.patch \
 	external/icu/Wdeprecated-copy-dtor.patch \
 	external/icu/icu4c-khmerbreakengine.patch.1 \
+    external/icu/icu4c-win-arm64.patch.1 \
 ))
 
 $(eval $(call gb_UnpackedTarball_add_file,icu,source/data/brkitr/khmerdict.dict,external/icu/khmerdict.dict))
diff --git a/external/icu/icu4c-win-arm64.patch.1 b/external/icu/icu4c-win-arm64.patch.1
new file mode 100644
index 000000000000..272310fed845
--- /dev/null
+++ b/external/icu/icu4c-win-arm64.patch.1
@@ -0,0 +1,76 @@
+diff -ur icu.org/source/acinclude.m4 icu/source/acinclude.m4
+--- icu.org/source/acinclude.m4     2020-04-10 16:22:16.000000000 +0200
++++ icu/source/acinclude.m4 2020-04-21 22:14:09.940217733 +0200
+@@ -52,6 +52,12 @@
+ 	else
+ 		icu_cv_host_frag=mh-cygwin-msvc
+ 	fi ;;
++aarch64-*-cygwin)
++	if test "$GCC" = yes; then
++		icu_cv_host_frag=mh-cygwin64
++	else
++		icu_cv_host_frag=mh-cygwin-msvc
++	fi ;;
+ *-*-mingw*)
+ 	if test "$GCC" = yes; then
+                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+diff -ur icu.org/source/configure.ac icu/source/configure.ac
+--- icu.org/source/configure.ac     2020-04-10 16:22:16.000000000 +0200
++++ icu/source/configure.ac 2020-04-21 22:14:09.940217733 +0200
+@@ -252,6 +252,23 @@
+     fi
+ fi
+ AC_SUBST(cross_buildroot)
++
++native_make="no"
++ENABLE_RELEASE=1
++AC_ARG_ENABLE(native-make,
++    [  --enable-native-make        build with naive make (Cygwin only) [default=no]],
++    [ case "${enableval}" in
++      yes|"") native_make="yes" ;;
++      esac ],
++)
++
++cross_path_buildroot="$cross_buildroot"
++if test "x$native_make" = "xyes"; then
++    case "${host}" in
++    *-*-cygwin*) cross_path_buildroot=$(cygpath -u "$cross_buildroot") ;;
++    esac
++fi
++AC_SUBST(cross_path_buildroot)
+ 
+ # Check for doxygen to generate documentation
+ AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/usr/bin)
+diff -ur icu.org/source/icudefs.mk.in icu/source/icudefs.mk.in
+--- icu.org/source/icudefs.mk.in     2020-04-10 16:22:16.000000000 +0200
++++ icu/source/icudefs.mk.in 2020-04-21 22:14:09.940217733 +0200
+@@ -40,6 +40,7 @@
+ # controls the include of $(top_builddir)/icucross.mk at bottom of file
+ cross_compiling = @cross_compiling@
+ cross_buildroot = @cross_buildroot@
++cross_path_buildroot = @cross_path_buildroot@
+ 
+ # Package information
+ 
+diff -ur icu.org/source/Makefile.in icu/source/Makefile.in
+--- icu.org/source/Makefile.in     2020-04-10 16:22:16.000000000 +0200
++++ icu/source/Makefile.in 2020-04-21 22:14:09.940217733 +0200
+@@ -90,15 +90,15 @@
+ 	  echo "TOOLEXEEXT=$(EXEEXT)" \
+ 	   ) > $@
+ 	@(echo 'TOOLBINDIR=$$(cross_buildroot)/bin' ;\
+-	  echo 'TOOLLIBDIR=$$(cross_buildroot)/lib' ;\
++	  echo 'TOOLLIBDIR=$$(cross_path_buildroot)/lib' ;\
+ 	  echo "INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(TOOLLIBDIR):$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$$$'"$(LDLIBRARYPATH_ENVVAR)" ;\
+ 	  echo "PKGDATA_INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$(TOOLLIBDIR):$$$$'"$(LDLIBRARYPATH_ENVVAR) " ;\
+ 	  echo ) >> $@
+ 
+ config/icucross.inc: $(top_builddir)/icudefs.mk  $(top_builddir)/Makefile @platform_make_fragment@
+ 	@echo rebuilding $@
+-	@(grep '^CURR_FULL_DIR' $(top_builddir)/icudefs.mk ; \
+-	  grep '^CURR_FULL_DIR' @platform_make_fragment@ || echo ""; \
++	@(grep '^CURR_FULL_DIR' @platform_make_fragment@ || echo ""; \
++	  grep '^CURR_FULL_DIR' $(top_builddir)/icudefs.mk ; \
+ 	   ) > $@
+ 
+ config/icu.pc: $(srcdir)/config/icu.pc.in
commit d91d51e5681e86af420022a5f941e9e1aa04a8b0
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Wed Jul 8 05:51:55 2020 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Wed Jul 8 06:50:55 2020 +0200

    WIP add dummy UNO bridge to continue compilation
    
    this is just a copy of the AMD64 Windows one without actual code changes.
    
    Change-Id: I9782a2e99c0231cdd1286af156ad312229eccf39

diff --git a/Repository.mk b/Repository.mk
index 5d3be2f78188..fc064e1d731b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -555,7 +555,9 @@ $(eval $(call gb_Helper_register_libraries_for_install,PLAINLIBS_URE,ure, \
 	) \
 	log_uno_uno \
 	unsafe_uno_uno \
-	$(if $(filter MSC,$(COM)),$(if $(filter INTEL,$(CPUNAME)),msci,mscx),gcc3)_uno \
+	$(if $(filter MSC,$(COM)), \
+        $(if $(filter INTEL,$(CPUNAME)),msci, \
+		$(if $(filter ARM64,$(CPUNAME)),msca,mscx)),gcc3)_uno \
 ))
 
 $(eval $(call gb_Helper_register_libraries_for_install,PRIVATELIBS_URE,ure, \
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index adb404244319..6718ce65b2b6 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -22,9 +22,17 @@ $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,gcc3_uno)) : \
 endif
 
 else ifeq ($(CPUNAME),ARM64)
+
+ifeq ($(COM),MSC)
+bridges_SELECTED_BRIDGE := msvc_win32_arm64
+bridge_exception_objects := cpp2uno uno2cpp
+bridge_noopt_objects := except
+bridge_asm_objects := call
+else
 bridges_SELECTED_BRIDGE := gcc3_ios
 bridge_noopt_objects := cpp2uno except uno2cpp
 bridge_asm_objects := ios64_helper
+endif
 
 else ifeq ($(CPUNAME),AARCH64)
 
diff --git a/bridges/source/cpp_uno/msvc_win32_arm64/call.asm b/bridges/source/cpp_uno/msvc_win32_arm64/call.asm
new file mode 100644
index 000000000000..fc12d6873af0
--- /dev/null
+++ b/bridges/source/cpp_uno/msvc_win32_arm64/call.asm
@@ -0,0 +1,112 @@
+; -*- Mode: text; tab-width: 8; indent-tabs-mode: nil comment-column: 44; comment-start: ";; " comment-start-skip: ";; *" -*-
+
+;;
+;; This file is part of the LibreOffice project.
+;;
+;; This Source Code Form is subject to the terms of the Mozilla Public
+;; License, v. 2.0. If a copy of the MPL was not distributed with this
+;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
+;;
+
+;; This is the function jumped to from the trampoline generated by
+;; codeSnippet() in cpp2uno.cxx. Here we call cpp_vtable_call() which
+;; then calls the actual UNO function.
+
+;; The code snippet generated is called from "normal" C++ code which
+;; has no idea that it is calling dynamically generated code.
+
+;; The generated short code snippet is not covered by any function
+;; table and unwind info, but that doesn't matter, as the instructions
+;; in it are not really going to cause any exception. Once it jumps
+;; here it is covered by a function table, and the calls further down
+;; through cpp_vtable_call() can be unwound cleanly.
+
+;; This is in a separate file for x86-64 as MSVC doesn't have in-line
+;; assembly for x64.
+
+;; Random web links and other documentation about low-level
+;; implementation details for the C++/UNO bridge on x64 Windows kept
+;; here:
+
+;; Caolan's "Lazy Hackers Guide To Porting" is useful:
+;; http://wiki.openoffice.org/wiki/Lazy_Hackers_Guide_To_Porting
+
+;; As for details about the x64 Windows calling convention, register
+;; usage, stack usage, exception handling etc, the official
+;; documentation (?) on MSDN is a bit fragmented and split up into a
+;; needlessly large number of short pages. But still:
+;; http://msdn.microsoft.com/en-us/library/7kcdt6fy%28v=VS.90%29.aspx
+
+;; Also see Raymond Chen's blog post:
+;; http://blogs.msdn.com/b/oldnewthing/archive/2004/01/14/58579.aspx
+
+;; This one is actually more readable: "Improving Automated Analysis
+;; of Windows x64 Binaries": http://www.uninformed.org/?v=4&a=1
+
+;; This one has a mass of information about different architectures
+;; and compilers, and contains some details about the x64 Windows
+;; calling convention in particular that Microsoft doesn't mention
+;; above:
+;; http://www.agner.org/optimize/calling_conventions.pdf
+
+;; Random interesting discussion threads:
+;; http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/300bd6d3-9381-4d2d-8129-e48b392c05d8
+
+;; Ken Johnson's blog http://www.nynaeve.net/ has much interesting
+;; information, for instance:
+;; http://www.nynaeve.net/?p=11
+
+typelib_TypeClass_FLOAT equ 10
+typelib_TypeClass_DOUBLE equ 11
+
+extern cpp_vtable_call: proc
+
+.code
+
+privateSnippetExecutor proc frame
+
+    ;; Make stack frame. Re-align RSP at 16 bytes. We need just one
+    ;; qword of stack for our own purposes: Where cpp_vtable_call()
+    ;; will store the return value of the UNO callee. But we of course
+    ;; must also allocate space for the functions we call (i.e., just
+    ;; cpp_vtable_call()) to spill their register parameters.
+
+    sub rsp, 40
+    .allocstack (40)
+    .endprolog
+
+    ;; Call cpp_vtable_call() with 2 parameters:
+
+    ;; 1 (rcx): nOffsetAndIndex (already put there in code generated by codeSnippet)
+    ;; 2 (rdx): pointer to where to store return value, followed by our
+    ;; return address (uninteresting to cpp_vtable_call()), followed
+    ;; by our spilled register parameters, as stored above, followed
+    ;; by the rest of our parameters, if any.
+
+    lea rdx, 32[rsp]
+
+    call cpp_vtable_call
+
+    ;; cpp_vtable_call() returns the typelib_TypeClass type of the
+    ;; return value of the called UNO function
+
+    cmp rax, typelib_TypeClass_FLOAT
+    je Lfloat
+
+    cmp rax, typelib_TypeClass_DOUBLE
+    je Lfloat
+
+    mov rax, qword ptr 32[rsp]
+    jmp Lepilogue
+
+Lfloat:
+    movsd xmm0, qword ptr 32[rsp]
+
+Lepilogue:
+    add rsp, 40
+    ret
+privateSnippetExecutor endp
+
+end
+
+; vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/bridges/source/cpp_uno/msvc_win32_arm64/call.hxx b/bridges/source/cpp_uno/msvc_win32_arm64/call.hxx
new file mode 100644
index 000000000000..668fb523edbd
--- /dev/null
+++ b/bridges/source/cpp_uno/msvc_win32_arm64/call.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MSVC_WIN32_X86_64_CALL_HXX
+#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MSVC_WIN32_X86_64_CALL_HXX
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+#include <typelib/typeclass.h>
+
+extern "C" typelib_TypeClass cpp_vtable_call(sal_Int64 nOffsetAndIndex, void** pStack);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/bridges/source/cpp_uno/msvc_win32_arm64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_arm64/cpp2uno.cxx
new file mode 100644
index 000000000000..d8b2220fc94c
--- /dev/null
+++ b/bridges/source/cpp_uno/msvc_win32_arm64/cpp2uno.cxx
@@ -0,0 +1,589 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <malloc.h>
+
+#include <com/sun/star/uno/genfunc.hxx>
+#include <sal/log.hxx>
+#include <uno/data.h>
+#include <typelib/typedescription.hxx>
+
+#include <bridge.hxx>
+#include <cppinterfaceproxy.hxx>
+#include <types.hxx>
+#include <vtablefactory.hxx>
+
+#include "call.hxx"
+#include "mscx.hxx"
+
+using namespace ::com::sun::star::uno;
+
+static typelib_TypeClass cpp2uno_call(
+    bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
+    const typelib_TypeDescription * pMemberTD,
+    typelib_TypeDescriptionReference * pReturnTypeRef, // NULL indicates void return
+    sal_Int32 nParams,
+    typelib_MethodParameter * pParams,
+    void ** pStack )
+{
+    // Return type
+    typelib_TypeDescription * pReturnTD = nullptr;
+    if ( pReturnTypeRef )
+        TYPELIB_DANGER_GET( &pReturnTD, pReturnTypeRef );
+
+    int nFirstRealParam = 3;    // Index into pStack, past return
+                                // value, return address and 'this'
+                                // pointer.
+
+    void * pUnoReturn = nullptr;
+    void * pCppReturn = nullptr; // Complex return ptr: if != NULL && != pUnoReturn, reconversion need
+
+    if ( pReturnTD )
+    {
+        if ( bridges::cpp_uno::shared::isSimpleType( pReturnTD ) )
+        {
+            pUnoReturn = pStack;
+        }
+        else
+        {
+            pCppReturn = pStack[nFirstRealParam++];
+
+            pUnoReturn = ( bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTD )
+                           ? alloca( pReturnTD->nSize )
+                           : pCppReturn ); // direct way
+        }
+    }
+
+    void ** pCppIncomingParams = pStack + nFirstRealParam;
+
+    // Unlike this method for other archs, prefer clarity to
+    // micro-optimization, and allocate these array separately
+
+    // Parameters passed to the UNO function
+    void ** pUnoArgs = static_cast<void **>(alloca( sizeof(void *) * nParams ));
+
+    // Parameters received from C++
+    void ** pCppArgs = static_cast<void **>(alloca( sizeof(void *) * nParams ));
+
+    // Indexes of values this have to be converted (interface conversion C++<=>UNO)
+    int * pTempIndexes =
+        static_cast<int *>(alloca( sizeof(int) * nParams ));
+
+    // Type descriptions for reconversions
+    typelib_TypeDescription ** ppTempParamTD =
+        static_cast<typelib_TypeDescription **>(alloca( sizeof(void *) * nParams ));
+
+    int nTempIndexes = 0;
+
+    for ( int nPos = 0; nPos < nParams; ++nPos )
+    {
+        const typelib_MethodParameter & rParam = pParams[nPos];
+
+        typelib_TypeDescription * pParamTD = nullptr;
+        TYPELIB_DANGER_GET( &pParamTD, rParam.pTypeRef );
+
+        if ( !rParam.bOut &&
+             bridges::cpp_uno::shared::isSimpleType( pParamTD ) )
+        {
+            pCppArgs[nPos] = pUnoArgs[nPos] = pCppIncomingParams++;
+
+            TYPELIB_DANGER_RELEASE( pParamTD );
+        }
+        else // ptr to complex value | ref
+        {
+            void * pCppStack;
+
+            pCppArgs[nPos] = pCppStack = *pCppIncomingParams++;
+
+            if ( !rParam.bIn ) // Pure out
+            {
+                // UNO out is unconstructed mem
+                pUnoArgs[nPos] = alloca( pParamTD->nSize );
+                pTempIndexes[nTempIndexes] = nPos;
+                // pParamTD will be released at reconversion
+                ppTempParamTD[nTempIndexes++] = pParamTD;
+            }
+            else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTD ) )
+            {
+                ::uno_copyAndConvertData(
+                    pUnoArgs[nPos] = alloca( pParamTD->nSize ),
+                    pCppStack, pParamTD,
+                    pThis->getBridge()->getCpp2Uno() );
+                pTempIndexes[nTempIndexes] = nPos; // Has to be reconverted
+                // pParamTD will be released at reconversion
+                ppTempParamTD[nTempIndexes++] = pParamTD;
+            }
+            else // direct way
+            {
+                pUnoArgs[nPos] = pCppStack;
+                // No longer needed
+                TYPELIB_DANGER_RELEASE( pParamTD );
+            }
+        }
+    }
+
+    // ExceptionHolder
+    uno_Any aUnoExc; // Any will be constructed by callee
+    uno_Any * pUnoExc = &aUnoExc;
+
+    // invoke UNO dispatch call
+    (*pThis->getUnoI()->pDispatcher)(
+        pThis->getUnoI(), pMemberTD, pUnoReturn, pUnoArgs, &pUnoExc );
+
+    // in case an exception occurred...
+    if ( pUnoExc )
+    {
+        // Destruct temporary in/inout params
+        while ( nTempIndexes-- )
+        {
+            int nIndex = pTempIndexes[nTempIndexes];
+
+            if ( pParams[nIndex].bIn ) // Is in/inout => was constructed
+            {
+                ::uno_destructData( pUnoArgs[nIndex], ppTempParamTD[nTempIndexes], nullptr );
+            }
+            TYPELIB_DANGER_RELEASE( ppTempParamTD[nTempIndexes] );
+        }
+        if ( pReturnTD )
+            TYPELIB_DANGER_RELEASE( pReturnTD );
+
+        CPPU_CURRENT_NAMESPACE::mscx_raiseException(
+            &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // Has to destruct the any
+
+        // Is here for dummy
+        return typelib_TypeClass_VOID;
+    }
+    else // Else, no exception occurred...
+    {
+        // Temporary params
+        while (nTempIndexes--)
+        {
+            int nIndex = pTempIndexes[nTempIndexes];
+            typelib_TypeDescription * pParamTD = ppTempParamTD[nTempIndexes];
+
+            if ( pParams[nIndex].bOut ) // inout/out
+            {
+                // Convert and assign
+                ::uno_destructData(
+                    pCppArgs[nIndex], pParamTD, cpp_release );
+                ::uno_copyAndConvertData(
+                    pCppArgs[nIndex], pUnoArgs[nIndex], pParamTD,
+                    pThis->getBridge()->getUno2Cpp() );
+            }
+            // Destroy temp UNO param
+            ::uno_destructData( pUnoArgs[nIndex], pParamTD, nullptr );
+
+            TYPELIB_DANGER_RELEASE( pParamTD );
+        }
+        // Return
+        if ( pCppReturn ) // Has complex return
+        {
+            if ( pUnoReturn != pCppReturn ) // Needs reconversion
+            {
+                ::uno_copyAndConvertData(
+                    pCppReturn, pUnoReturn, pReturnTD,
+                    pThis->getBridge()->getUno2Cpp() );
+                // Destroy temp UNO return
+                ::uno_destructData( pUnoReturn, pReturnTD, nullptr );
+            }
+            // Complex return ptr is set to eax
+            pStack[0] = pCppReturn;
+        }
+        if ( pReturnTD )
+        {
+            typelib_TypeClass eRet = pReturnTD->eTypeClass;
+            TYPELIB_DANGER_RELEASE( pReturnTD );
+            return eRet;
+        }
+        else
+            return typelib_TypeClass_VOID;
+    }
+}
+
+extern "C" typelib_TypeClass cpp_vtable_call(
+    sal_Int64 nOffsetAndIndex,
+    void ** pStack )
+{
+    sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
+    sal_Int32 nVtableOffset = ((nOffsetAndIndex >> 32) & 0xFFFFFFFF);
+
+    // pStack points to space for return value allocated by
+    // privateSnippetExecutor() in call.asm, after which follows our
+    // return address (uninteresting), then the integer or
+    // floating-point register parameters (spilled by
+    // privateSnippetExecutor()) from the call to the trampoline,
+    // followed by stacked parameters. The first parameter is the
+    // 'this' pointer. If the callee returns a large value, the
+    // parameter after that is actually a pointer to where the callee
+    // should store its return value.
+
+    void * pThis = static_cast<char *>( pStack[2] ) - nVtableOffset;
+
+    bridges::cpp_uno::shared::CppInterfaceProxy * pCppI =
+        bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy( pThis );
+
+    typelib_InterfaceTypeDescription * pTD = pCppI->getTypeDescr();
+
+    SAL_INFO( "bridges", "cpp_vtable_call: pCallStack=[" <<
+            std::hex << pStack[0] << "," << pStack[1] << "," << pStack[2] << ",...], pThis=" <<
+            pThis << ", pCppI=" << pCppI <<
+            std::dec << ", nFunctionIndex=" << nFunctionIndex << ", nVtableOffset=" << nVtableOffset );
+    SAL_INFO( "bridges", "name=" << OUString::unacquired(&pTD->aBase.pTypeName) );
+
+    if ( nFunctionIndex >= pTD->nMapFunctionIndexToMemberIndex )
+    {
+        SAL_WARN(
+            "bridges",
+            "illegal " << OUString::unacquired(&pTD->aBase.pTypeName)
+                << " vtable index " << nFunctionIndex << "/"
+                << pTD->nMapFunctionIndexToMemberIndex);
+        throw RuntimeException(
+            ("illegal " + OUString::unacquired(&pTD->aBase.pTypeName)
+             + " vtable index " + OUString::number(nFunctionIndex) + "/"
+             + OUString::number(pTD->nMapFunctionIndexToMemberIndex)),
+            reinterpret_cast<XInterface *>( pCppI ) );
+    }
+
+    // Determine called method
+    int nMemberPos = pTD->pMapFunctionIndexToMemberIndex[nFunctionIndex];
+    assert(nMemberPos < pTD->nAllMembers);
+
+    TypeDescription aMemberDescr( pTD->ppAllMembers[nMemberPos] );
+
+    SAL_INFO( "bridges", "Calling " << OUString::unacquired(&aMemberDescr.get()->pTypeName) );
+
+    typelib_TypeClass eRet;
+    switch ( aMemberDescr.get()->eTypeClass )
+    {
+        case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+        {
+            typelib_TypeDescriptionReference *pAttrTypeRef =
+                reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( aMemberDescr.get() )->pAttributeTypeRef;
+
+            if ( pTD->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex )
+            {
+                // is GET method
+                eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef,
+                        0, nullptr, // No params
+                        pStack );
+            }
+            else
+            {
+                // is SET method
+                typelib_MethodParameter aParam;
+                aParam.pTypeRef = pAttrTypeRef;
+                aParam.bIn      = true;
+                aParam.bOut     = false;
+
+                eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
+                        nullptr, // Indicates void return
+                        1, &aParam,
+                        pStack );
+            }
+            break;
+        }
+        case typelib_TypeClass_INTERFACE_METHOD:
+        {
+            // is METHOD
+            switch ( nFunctionIndex )
+            {
+                case 1: // acquire()
+                    pCppI->acquireProxy(); // Non virtual call!
+                    eRet = typelib_TypeClass_VOID;
+                    break;
+                case 2: // release()
+                    pCppI->releaseProxy(); // non virtual call!
+                    eRet = typelib_TypeClass_VOID;
+                    break;
+                case 0: // queryInterface() opt
+                {
+                    typelib_TypeDescription * pTD2 = nullptr;
+
+                    // the incoming C++ parameters are: The this
+                    // pointer, the hidden return value pointer, and
+                    // then the actual queryInterface() only
+                    // parameter. Thus pStack[4]..
+
+                    TYPELIB_DANGER_GET( &pTD2, static_cast<Type *>( pStack[4] )->getTypeLibType() );
+
+                    if ( pTD2 )
+                    {
+                        XInterface * pInterface = nullptr;
+                        (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
+                            ( pCppI->getBridge()->getCppEnv(),
+                              reinterpret_cast<void **>(&pInterface),
+                              pCppI->getOid().pData,
+                              reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD2 ) );
+
+                        if ( pInterface )
+                        {
+                            // pStack[3] = hidden return value pointer
+                            ::uno_any_construct( static_cast<uno_Any *>( pStack[3] ),
+                                                 &pInterface, pTD2, cpp_acquire );
+
+                            pInterface->release();
+                            TYPELIB_DANGER_RELEASE( pTD2 );
+
+                            pStack[0] = pStack[3];
+                            eRet = typelib_TypeClass_ANY;
+                            break;
+                        }
+                        TYPELIB_DANGER_RELEASE( pTD2 );
+                    }
+                    [[fallthrough]];
+                }
+                default:
+                {
+                    typelib_InterfaceMethodTypeDescription * pMethodTD =
+                        reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( aMemberDescr.get() );
+
+                    eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
+                                         pMethodTD->pReturnTypeRef,
+                                         pMethodTD->nParams,
+                                         pMethodTD->pParams,
+                                         pStack );
+                }
+            }
+            break;
+        }
+        default:
+        {
+            throw RuntimeException("No member description found!",
+                                    reinterpret_cast<XInterface *>( pCppI ) );
+        }
+    }
+
+    return eRet;
+}
+
+int const codeSnippetSize = 48;
+
+extern "C" char privateSnippetExecutor;
+
+// This function generates the code that acts as a proxy for the UNO function to be called.
+// The generated code does the following:
+// - Spills register parameters on stack
+// - Loads functionIndex and vtableOffset into scratch registers
+// - Jumps to privateSnippetExecutor
+
+static unsigned char * codeSnippet(
+    unsigned char * code,
+    CPPU_CURRENT_NAMESPACE::RegParamKind param_kind[4],
+    sal_Int32 nFunctionIndex,
+    sal_Int32 nVtableOffset )
+{
+    sal_uInt64 nOffsetAndIndex = ( static_cast<sal_uInt64>(nVtableOffset) << 32 ) | static_cast<sal_uInt64>(nFunctionIndex);
+    unsigned char *p = code;
+
+    // Spill parameters
+    if ( param_kind[0] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+    {
+        // mov qword ptr 8[rsp], rcx
+        *p++ = 0x48; *p++ = 0x89; *p++ = 0x4C; *p++ = 0x24; *p++ = 0x08;
+    }
+    else
+    {
+        // movsd qword ptr 8[rsp], xmm0
+        *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x44; *p++ = 0x24; *p++ = 0x08;
+    }
+    if ( param_kind[1] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+    {
+        // mov qword ptr 16[rsp], rdx
+        *p++ = 0x48; *p++ = 0x89; *p++ = 0x54; *p++ = 0x24; *p++ = 0x10;
+    }
+    else
+    {
+        // movsd qword ptr 16[rsp], xmm1
+        *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x4C; *p++ = 0x24; *p++ = 0x10;
+    }
+    if ( param_kind[2] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+    {
+        // mov qword ptr 24[rsp], r8
+        *p++ = 0x4C; *p++ = 0x89; *p++ = 0x44; *p++ = 0x24; *p++ = 0x18;
+    }
+    else
+    {
+        // movsd qword ptr 24[rsp], xmm2
+        *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x54; *p++ = 0x24; *p++ = 0x18;
+    }
+    if ( param_kind[3] == CPPU_CURRENT_NAMESPACE::REGPARAM_INT )
+    {
+        // mov qword ptr 32[rsp], r9
+        *p++ = 0x4C;*p++ = 0x89; *p++ = 0x4C; *p++ = 0x24; *p++ = 0x20;
+    }
+    else
+    {
+        // movsd qword ptr 32[rsp], xmm3
+        *p++ = 0xF2; *p++ = 0x0F; *p++ = 0x11; *p++ = 0x5C; *p++ = 0x24; *p++ = 0x20;
+    }
+
+    // mov rcx, nOffsetAndIndex
+    *p++ = 0x48; *p++ = 0xB9;
+    *reinterpret_cast<sal_uInt64 *>(p) = nOffsetAndIndex; p += 8;
+
+    // mov r11, privateSnippetExecutor
+    *p++ = 0x49; *p++ = 0xBB;
+    *reinterpret_cast<void **>(p) = &privateSnippetExecutor; p += 8;
+
+    // jmp r11
+    *p++ = 0x41; *p++ = 0xFF; *p++ = 0xE3;
+
+    assert(p < code + codeSnippetSize);
+
+    return code + codeSnippetSize;
+}
+
+struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
+
+bridges::cpp_uno::shared::VtableFactory::Slot *
+bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(
+    void * block )
+{
+    return static_cast< Slot * >(block) + 1;
+}
+
+std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
+    sal_Int32 slotCount )
+{
+    return (slotCount + 1) * sizeof (Slot) + slotCount * codeSnippetSize;
+}
+
+bridges::cpp_uno::shared::VtableFactory::Slot *
+bridges::cpp_uno::shared::VtableFactory::initializeBlock(
+    void * block,
+    sal_Int32 slotCount,
+    sal_Int32, typelib_InterfaceTypeDescription * )
+{
+    struct Rtti {
+        sal_Int32 n0, n1, n2;
+        type_info * rtti;
+        Rtti():
+            n0(0), n1(0), n2(0),
+            rtti(CPPU_CURRENT_NAMESPACE::mscx_getRTTI(
+                     "com.sun.star.uno.XInterface"))
+        {}
+    };
+    static Rtti rtti;
+
+    Slot * slots = mapBlockToVtable(block);
+    slots[-1].fn = &rtti;
+    return slots + slotCount;
+}
+
+unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
+    Slot ** slots,
+    unsigned char * code,
+    typelib_InterfaceTypeDescription const * type,
+    sal_Int32 nFunctionOffset,
+    sal_Int32 functionCount,
+    sal_Int32 nVtableOffset )
+{
+    (*slots) -= functionCount;
+    Slot * s = *slots;
+
+    for (int member = 0; member < type->nMembers; ++member) {
+        typelib_TypeDescription * pTD = nullptr;
+
+        TYPELIB_DANGER_GET( &pTD, type->ppMembers[ member ] );
+        assert(pTD);
+
+        CPPU_CURRENT_NAMESPACE::RegParamKind param_kind[4];
+        int nr = 0;
+
+        for (int i = 0; i < 4; ++i)
+            param_kind[i] = CPPU_CURRENT_NAMESPACE::REGPARAM_INT;
+
+        // 'this'
+        ++nr;
+
+        if ( pTD->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE )
+        {
+            typelib_InterfaceAttributeTypeDescription * pIfaceAttrTD =
+                reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( pTD );
+
+            // Getter
+
+            (s++)->fn = code;
+            code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
+            if ( ! pIfaceAttrTD->bReadOnly )
+            {
+                typelib_TypeDescription * pAttrTD = nullptr;
+                TYPELIB_DANGER_GET( &pAttrTD, pIfaceAttrTD->pAttributeTypeRef );
+                assert(pAttrTD);
+
+                // Setter
+                if ( pAttrTD->eTypeClass == typelib_TypeClass_FLOAT ||
+                     pAttrTD->eTypeClass == typelib_TypeClass_DOUBLE )
+                    param_kind[nr++] = CPPU_CURRENT_NAMESPACE::REGPARAM_FLT;
+
+                TYPELIB_DANGER_RELEASE( pAttrTD );
+
+                (s++)->fn = code;
+                code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
+            }
+        }
+        else if ( pTD->eTypeClass == typelib_TypeClass_INTERFACE_METHOD )
+        {
+            typelib_InterfaceMethodTypeDescription * pMethodTD =
+                reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( pTD );
+
+            typelib_TypeDescription * pReturnTD = nullptr;
+            TYPELIB_DANGER_GET( &pReturnTD, pMethodTD->pReturnTypeRef );
+            assert(pReturnTD);
+
+            if ( !bridges::cpp_uno::shared::isSimpleType( pReturnTD ) )
+            {
+                // Return value
+                ++nr;
+            }
+
+            for (int param = 0; nr < 4 && param < pMethodTD->nParams; ++param, ++nr)
+            {
+                typelib_TypeDescription * pParamTD = nullptr;
+
+                TYPELIB_DANGER_GET( &pParamTD, pMethodTD->pParams[param].pTypeRef );
+                assert(pParamTD);
+
+                if ( pParamTD->eTypeClass == typelib_TypeClass_FLOAT ||
+                     pParamTD->eTypeClass == typelib_TypeClass_DOUBLE )
+                    param_kind[nr] = CPPU_CURRENT_NAMESPACE::REGPARAM_FLT;
+
+                TYPELIB_DANGER_RELEASE( pParamTD );
+            }
+            (s++)->fn = code;
+            code = codeSnippet( code, param_kind, nFunctionOffset++, nVtableOffset );
+
+            TYPELIB_DANGER_RELEASE( pReturnTD );
+        }
+        else
+            assert(false);
+
+        TYPELIB_DANGER_RELEASE( pTD );
+    }
+    return code;
+}
+
+void bridges::cpp_uno::shared::VtableFactory::flushCode(
+    unsigned char const *,
+    unsigned char const * )
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/bridges/source/cpp_uno/msvc_win32_arm64/except.cxx b/bridges/source/cpp_uno/msvc_win32_arm64/except.cxx
new file mode 100644
index 000000000000..daa0426a2c17
--- /dev/null
+++ b/bridges/source/cpp_uno/msvc_win32_arm64/except.cxx
@@ -0,0 +1,935 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// Interesting info can be found in:
+
+// MSDN, obviously
+
+// http://www.osronline.com/article.cfm?article=469
+
+// ONTL, "Open NT Native Template Library", a C++ STL-like library
+// that can be used even when writing Windows drivers. This is some
+// quite badass code. The author has done impressive heavy spelunking
+// of MSVCR structures. http://code.google.com/p/ontl/
+
+// Geoff Chappell's pages:
+// http://www.geoffchappell.com/studies/msvc/language/index.htm
+
+// The below is from ONTL's ntl/nt/exception.hxx, cleaned up to keep just the _M_X64 parts:
+
+#if 0
+
+/* This information until the corresponding '#endif // 0' is covered
+ * by ONTL's license, which is said to be the "zlib/libpng license"
+ * below, which as far as I see is permissive enough to allow this
+ * information to be included here in this source file. Note that no
+ * actual code from ONTL below gets compiled into the object file.
+ */
+
+/*
+ * Copyright (c) 2011 <copyright holders> (The ONTL main
+ * developer(s) don't tell their real name(s) on the ONTL site.)
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ *     1. The origin of this software must not be misrepresented; you must not
+ *     claim that you wrote the original software. If you use this software
+ *     in a product, an acknowledgment in the product documentation would be
+ *     appreciated but is not required.
+ *
+ *     2. Altered source versions must be plainly marked as such, and must not be
+ *     misrepresented as being the original software.
+ *
+ *     3. This notice may not be removed or altered from any source
+ *     distribution.
+ *
+ */
+
+typedef uint32_t rva_t;
+
+///\note the calling convention should not matter since this has no arguments
+typedef void generic_function_t();
+
+struct ptrtomember // _PMD
+{
+  typedef __w64 int32_t  mdiff_t;
+  mdiff_t member_offset;
+  mdiff_t vbtable_offset; // -1 if not a virtual base
+  mdiff_t vdisp_offset;   // offset to the displacement value inside the vbtable
+
+  template<typename T>
+  T * operator()(T * const thisptr) const
+  {
+    uintptr_t tp = reinterpret_cast<uintptr_t>(thisptr);
+    uintptr_t ptr = tp + member_offset;
+    if ( vbtable_offset != -1 ) // !(vbtable_offset < 0)
+    {
+      ptr += *reinterpret_cast<mdiff_t*>( static_cast<intptr_t>(vdisp_offset + *reinterpret_cast<mdiff_t*>(tp + vbtable_offset)) )
+        + vbtable_offset;
+    }
+    return reinterpret_cast<T*>(ptr);
+  }
+};
+
+struct eobject
+{
+  typedef void (* dtor_ptr )(eobject*);
+  typedef void (* ctor_ptr )(eobject*, eobject*);
+  typedef void (* ctor_ptr2)(eobject*, eobject*, int);
+};
+
+struct catchabletype
+{
+  /** is simple type */
+  uint32_t    memmoveable : 1;
+  /** catchable as reference only */
+  uint32_t    refonly     : 1;
+  /** class with virtual base */
+  uint32_t    hasvirtbase : 1;
+  /** offset to the type descriptor */
+  rva_t       typeinfo;
+
+  /** catch type instance location within a thrown object  */
+  ptrtomember thiscast;
+  /** size of the simple type or offset into buffer of \c this pointer for catch object */
+  uint32_t    object_size;
+
+  union
+  {
+    rva_t               copyctor;
+    rva_t               copyctor2;
+  };
+};
+
+#pragma pack(push, 4)
+struct catchabletypearray
+{
+  uint32_t        size;
+  rva_t           type[1];
+};
+#pragma pack(pop)
+
+#pragma pack(push, 4)
+struct throwinfo
+{
+  typedef exception_disposition __cdecl forwardcompathandler_t(...);
+
+  /* 0x00 */  uint32_t  econst    : 1;
+  /* 0x00 */  uint32_t  evolatile : 1;
+  /* 0x00 */  uint32_t            : 1;
+  /* 0x00 */  uint32_t  e8        : 1;
+  /* 0x04 */  rva_t     exception_dtor;
+  /* 0x08 */  rva_t     forwardcompathandler;
+  /* 0x0C */  rva_t     catchabletypearray; ///< types able to catch the exception.
+};
+#pragma pack(pop)
+
+/// This type represents the catch clause
+struct ehandler
+{
+  //  union { uint32_t  adjectives; void * ptr; };
+  uint32_t isconst      : 1;
+  uint32_t isvolatile   : 1;
+  uint32_t isunaligned  : 1;// guess it is not used on x86
+  uint32_t isreference  : 1;
+
+  uint32_t              :27;
+  uint32_t ishz         : 1;
+
+  /** offset to the type descriptor of this catch object */
+  /*0x04*/ rva_t        typeinfo;         // dispType
+  /*0x08*/ int          eobject_bpoffset; // dispCatchObj
+  /** offset to the catch clause funclet */
+  /*0x0C*/ rva_t        handler;          // dispOfHandler
+  /*0x10*/ uint32_t     frame;            // dispFrame
+}
+
+// ___BuildCatchObject
+/// 15.3/16 When the exception-declaration specifies a class type, a copy
+///         constructor is used to initialize either the object declared
+///         in the exception-declaration or,
+///         if the exception-declaration does not specify a name,
+///         a temporary object of that type.
+///\note    This is the question may we optimize out the last case.
+///\warning If the copy constructor throws an exception, std::unexpected would be called
+void
+  constructcatchobject(
+  cxxregistration *             cxxreg,
+  const ehandler *        const catchblock,
+  catchabletype *         const convertible,
+  const dispatcher_context* const dispatch
+  )
+  const
+{
+  _EH_TRACE_ENTER();
+  // build helper
+  __try {
+    struct typeinfo_t { void* vtbl; void* spare; char name[1]; };
+    enum catchable_info { cidefault, cicomplex, civirtual } cinfo = cidefault;
+
+    const typeinfo_t* ti = catchblock->typeinfo ? dispatch->va<typeinfo_t*>(catchblock->typeinfo) : NULL;
+    if(ti && *ti->name && (catchblock->eobject_bpoffset || catchblock->ishz)){
+      eobject** objplace = catchblock->ishz
+        ? reinterpret_cast<eobject**>(cxxreg)
+        : reinterpret_cast<eobject**>(catchblock->eobject_bpoffset + cxxreg->fp.FramePointers);
+      if(catchblock->isreference){
+        // just ref/pointer
+        *objplace = adjust_pointer(get_object(), convertible);
+      }else if(convertible->memmoveable){
+        // POD
+        std::memcpy(objplace, get_object(), convertible->object_size);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list