Date: Sun, 17 Apr 2022 15:49:39 +0000 From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 263370] devel/libunwind: unwind.h incompatible with base unwind.h Message-ID: <bug-263370-7788@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263370 Bug ID: 263370 Summary: devel/libunwind: unwind.h incompatible with base unwind.h Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: sunpoet@FreeBSD.org Reporter: tijl@FreeBSD.org CC: brooks@FreeBSD.org, dim@FreeBSD.org, emaste@freebsd.org, jhb@FreeBSD.org, pkubaj@FreeBSD.org, re@FreeBSD.org Blocks: 262008 Flags: maintainer-feedback?(sunpoet@FreeBSD.org) CC: Assignee: sunpoet@FreeBSD.org The base system unwind.h (since base c00d34566536) aligns struct _Unwind_Exception using __attribute__((__aligned__)) which is 16 byte align= ment on i386 and amd64. The unwind.h from devel/libunwind used to have this as = well but replaced it (erroneously) with _Alignas(8) in version 1.6 which is incompatible. This difference affects the layout (size, alignment, padding, field offsets) of struct __cxa_exception in cxxabi.h. By default libreoffice depends on gstreamer which by default depends on devel/libunwind, so with default options libreoffice is built with the wrong _Unwind_Exception and __cxa_exception. This leads to crashes already during build, at least on i386 (gengal.bin segfaults as reported in bug 262008). = For amd64, libreoffice has hacks in place to detect ABI differences at runtime which also happen to work in this case. I suspect the same happens with openoffice. Either devel/libunwind needs a patch that reverts https://github.com/libunwind/libunwind/commit/da8dc856ab5646e04160060aae942= 5db3f5428ce#diff-0b26e6872c56fde17faa6297bdcd1cc72357de35a30894de5d48b4006e= 5fe83a=3D but how does that affect older versions of FreeBSD? Or it could be configu= red with --disable-unwind-header so its unwind.h isn't installed, but then how = does that affect other ports? Additionally, the comments in struct __cxa_exception in cxxabi.h state that _Unwind_Exception is 64-bit aligned and that adding referenceCount at the beginning is safe. This may have been true at the time because LLVM libunw= ind added __attribute__((__aligned__)) later (to be GCC compatible I think: https://github.com/llvm/llvm-project/commit/19f802ff68361af0a28c8ad6e12daf9= bd740b96d), but it's not safe now and the GCC folks were bitten by this as well (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D38732). For architectures = where __attribute__((__aligned__)) means 16 byte alignment adding it to _Unwind_Exception also adds 8 bytes of padding right before the unwindHeader field in __cxa_exception which breaks ABI. That's why libreoffice on amd64= has the hacks I mentioned above. Could we change our libcxxrt similar to what libc++abi did in https://github.com/llvm/llvm-project/commit/f2a436058fcbc11291e73badb44e243= f61046183? I believe that way we maintain ABI compatibility at least on 64-bit architectures, i.e. libreoffice built with FreeBSD 13.0 cxxabi.h and unwind= .h (or devel/libunwind unwind.h with _Alignas(8)) would then run on FreeBSD 13= .1.=20 Can we delay FreeBSD 13.1 release until this is fully understood and sorted out? Referenced Bugs: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D262008 [Bug 262008] editors/libreoffice failed to build --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-263370-7788>