Created attachment 233519 [details] patch Patch libreoffice to replace __cxa_get_globals()->caughtExceptions, which is a pointer to the start of a struct __cxa_exception, with __cxa_current_primary_exception(), which is a pointer to the end. This allows struct __cxa_exception to be extended at the start as was recently done in FreeBSD main and stable/13 on 64-bit architectures. Recently on FreeBSD main and stable/13 __attribute__((__aligned__)) was added to struct _Unwind_Exception which changes its size on 32-bit architectures, and that of __cxa_exception as well. Patch libreoffice to detect this so packages built on 13.0 still work on 13.1. Change the LIB_DEPENDS on libunwind to a BUILD_DEPENDS because we only need unwind.h (for FreeBSD 13.0 and older where that header is hidden in /usr/include/c++/v1). I've build and run tested on i386 and I'll test on amd64 as well but it would be nice if others could test aarch64 and powerpc. Note that this patch depends on the one in bug 263370.
(In reply to Tijl Coosemans from comment #0) Feel free to commit both patches
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=35a5054819f15db65cd25a661887805550aedbc7 commit 35a5054819f15db65cd25a661887805550aedbc7 Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2022-04-27 16:51:19 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-04-27 16:53:04 +0000 editors/libreoffice: make robust against __cxa_exception ABI changes Patch libreoffice to replace __cxa_get_globals()->caughtExceptions, which is a pointer to the start of a struct __cxa_exception, with __cxa_current_primary_exception(), which is a pointer to the end. This allows struct __cxa_exception to be extended at the start as was recently done in FreeBSD main and stable/13 on 64-bit architectures. Recently on FreeBSD main and stable/13 __attribute__((__aligned__)) was added to struct _Unwind_Exception which changes its size on 32-bit architectures, and that of __cxa_exception as well. Patch libreoffice to detect this so packages built on 13.0 still work on 13.1. Change the LIB_DEPENDS on libunwind to a BUILD_DEPENDS because we only need unwind.h (for FreeBSD 13.0 and older where that header is hidden in /usr/include/c++/v1). PR: 263596 Approved by: office (fluffy) editors/libreoffice/Makefile | 12 +--- ...ce_cpp__uno_gcc3__linux__aarch64_abi.cxx (gone) | 11 ---- ...cpp__uno_gcc3__linux__aarch64_uno2cpp.cxx (new) | 25 ++++++++ ...s_source_cpp__uno_gcc3__linux__intel_except.cxx | 60 ++++++++++++++++-- ..._source_cpp__uno_gcc3__linux__x86-64_except.cxx | 46 +++++++++++--- ...es-source-cpp_uno-gcc3_linux_powerpc-except.cxx | 74 ++++++++++++++-------- ...-source-cpp_uno-gcc3_linux_powerpc64-except.cxx | 52 ++++++++------- 7 files changed, 197 insertions(+), 83 deletions(-)
A commit in branch 2022Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=bd9f0cee99a8822c19b155fd7c05bdfb5bce3c9d commit bd9f0cee99a8822c19b155fd7c05bdfb5bce3c9d Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2022-04-27 16:51:19 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-04-27 17:01:40 +0000 editors/libreoffice: make robust against __cxa_exception ABI changes Patch libreoffice to replace __cxa_get_globals()->caughtExceptions, which is a pointer to the start of a struct __cxa_exception, with __cxa_current_primary_exception(), which is a pointer to the end. This allows struct __cxa_exception to be extended at the start as was recently done in FreeBSD main and stable/13 on 64-bit architectures. Recently on FreeBSD main and stable/13 __attribute__((__aligned__)) was added to struct _Unwind_Exception which changes its size on 32-bit architectures, and that of __cxa_exception as well. Patch libreoffice to detect this so packages built on 13.0 still work on 13.1. Change the LIB_DEPENDS on libunwind to a BUILD_DEPENDS because we only need unwind.h (for FreeBSD 13.0 and older where that header is hidden in /usr/include/c++/v1). PR: 263596 Approved by: office (fluffy) (cherry picked from commit 35a5054819f15db65cd25a661887805550aedbc7) editors/libreoffice/Makefile | 12 +--- ...ce_cpp__uno_gcc3__linux__aarch64_abi.cxx (gone) | 11 ---- ...cpp__uno_gcc3__linux__aarch64_uno2cpp.cxx (new) | 25 ++++++++ ...s_source_cpp__uno_gcc3__linux__intel_except.cxx | 60 ++++++++++++++++-- ..._source_cpp__uno_gcc3__linux__x86-64_except.cxx | 46 +++++++++++--- ...es-source-cpp_uno-gcc3_linux_powerpc-except.cxx | 74 ++++++++++++++-------- ...-source-cpp_uno-gcc3_linux_powerpc64-except.cxx | 52 ++++++++------- 7 files changed, 197 insertions(+), 83 deletions(-)
Thanks for the patch, does it make sense also sending to upstream?
(In reply to Li-Wen Hsu from comment #4) No, __cxa_current_primary_exception isn't implemented by gcc (libsupc++), so there would have to be an #ifdef/#else around it. I also didn't adjust code behind #if that isn't used on FreeBSD. I can work out a better patch for upstream but I'm looking at fixing openoffice first now.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=cb615a168346531cae978670e90a858f233946df commit cb615a168346531cae978670e90a858f233946df Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2022-04-28 11:25:44 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-04-28 11:58:19 +0000 editors/libreoffice: warn users about libcxxrt ABI incompatibility Mark BROKEN on affected versions of FreeBSD main and stable/13 and tell users to update FreeBSD first so they have the latest libcxxrt. PR: 263596 editors/libreoffice/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)
A commit in branch 2022Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=dd1c307fd52f0be584aa6eef745d9b1a5159e04e commit dd1c307fd52f0be584aa6eef745d9b1a5159e04e Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2022-04-28 11:25:44 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-04-28 12:11:26 +0000 editors/libreoffice: warn users about libcxxrt ABI incompatibility Mark BROKEN on affected versions of FreeBSD main and stable/13 and tell users to update FreeBSD first so they have the latest libcxxrt. PR: 263596 (cherry picked from commit cb615a168346531cae978670e90a858f233946df) editors/libreoffice/Makefile | 7 +++++++ 1 file changed, 7 insertions(+)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=ca1c4839224a639c0ddd602a21b942efa4ca0952 commit ca1c4839224a639c0ddd602a21b942efa4ca0952 Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2022-04-30 17:03:16 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-05-01 08:27:53 +0000 editors/libreoffice: fix i386/powerpc libcxxrt ABI change detection This makes the bundled bridgetest_server/bridgetest_client working. Recently the size of struct __cxa_exception changed on 32 bit architectures. A patch committed in 35a5054819f1 lets libreoffice detect this by comparing a field of the struct against a known value. In the bridgetest it turns out this value isn't always the same, so use a different field instead. PR: 263596 editors/libreoffice/Makefile | 2 +- ...h-bridges_source_cpp__uno_gcc3__linux__intel_except.cxx | 14 +++++++++----- ...ch-bridges-source-cpp_uno-gcc3_linux_powerpc-except.cxx | 10 +++++++--- 3 files changed, 17 insertions(+), 9 deletions(-)
A commit in branch 2022Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=2da3b360fc609a03871e31c4c2c4830beeca478f commit 2da3b360fc609a03871e31c4c2c4830beeca478f Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2022-04-30 17:03:16 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-05-01 09:09:13 +0000 editors/libreoffice: fix i386/powerpc libcxxrt ABI change detection This makes the bundled bridgetest_server/bridgetest_client working. Recently the size of struct __cxa_exception changed on 32 bit architectures. A patch committed in 35a5054819f1 lets libreoffice detect this by comparing a field of the struct against a known value. In the bridgetest it turns out this value isn't always the same, so use a different field instead. PR: 263596 (cherry picked from commit ca1c4839224a639c0ddd602a21b942efa4ca0952) editors/libreoffice/Makefile | 2 +- ...h-bridges_source_cpp__uno_gcc3__linux__intel_except.cxx | 14 +++++++++----- ...ch-bridges-source-cpp_uno-gcc3_linux_powerpc-except.cxx | 10 +++++++--- 3 files changed, 17 insertions(+), 9 deletions(-)