From nobody Sat Mar 5 21:34:40 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CF9BB19E888E for ; Sat, 5 Mar 2022 21:34:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K9yg15Djvz4bV2; Sat, 5 Mar 2022 21:34:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646516093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fNsEP6pBFP2JLXtM5r0faQB0TfWzBUw5zqoIqaqQ4kQ=; b=BM0i4M2yF3erwECSEzmW27NFJg00r2iKt+tT5viTjyjoMlHjQkXwVNMkcLKUEDpTkuW/bp VC/OskH0o6zMWPr8tSU8oygqHEpHsX+9GqV4nEw2k35IA+JNbHSaGQy2myTM/IA+fhLotb WhJ09xxhXs1OBsbWd7+cDRjA/2bHpNRU4DTJs0M3H1yLAgrB8USbQtaapS20B1e0no4F1Y QezTUC9keVMselaoq6gslhObQNaaS4/tHFIpqyqVN6IC4OnV+9CiwApPMh9IbTlszxDKEq Qdl90+jH+ey+gcD/f43ccpEpPDKpeCQBb/FSE0P0rqx/hoDVgb6HH7PrZM0hJw== Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "R3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 784402447A; Sat, 5 Mar 2022 21:34:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtpclient.apple (longrow.home.andric.com [192.168.0.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id C65FD32FA4; Sat, 5 Mar 2022 22:34:49 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_0655F321-539A-465B-BB9C-D0EF8E7F9DE6"; protocol="application/pgp-signature"; micalg=pgp-sha1 List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: git: b2127b6f1ae2 - stable/13 - Install unwind.h into /usr/include From: Dimitry Andric In-Reply-To: <20220305113613.7760bb3845cda1c04707fb34@dec.sakura.ne.jp> Date: Sat, 5 Mar 2022 22:34:40 +0100 Cc: John Baldwin , Ed Maste , dev-commits-src-branches@freebsd.org Message-Id: <7482C54A-1128-4AFF-A74E-53D88334C1D9@FreeBSD.org> References: <20220303224535.a0cca57e1f033e930a7f8f9d@dec.sakura.ne.jp> <3166E99F-1616-40D9-BD8B-D18E8104D6FF@FreeBSD.org> <6E5AD771-3140-480A-BF20-95B8E8A27189@FreeBSD.org> <20220305113613.7760bb3845cda1c04707fb34@dec.sakura.ne.jp> To: Tomoaki AOKI X-Mailer: Apple Mail (2.3693.60.0.1.1) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646516093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fNsEP6pBFP2JLXtM5r0faQB0TfWzBUw5zqoIqaqQ4kQ=; b=d1lfck+6bFxdBWFN07Mev38XkkRd5qRrSQBkGQnU/m0hL5TE7z567vYctKTWgBz0NsHOph jDto0vLQ1zVBGgQ2EHLc4Fy/i9EtqDd7uVPMkhzfBpn9DmSqQGsrCWy6c6kKFfhkYkNaUC O+N9fkk9oYOyUFTBSV9QymjYdhsH1HhkKuoMYLx62nd/tBbf0qcoqai4Xzk4hzsSeUpp/f 6JqtE7SR98fFdpSpf9S9eaF8jsITR24EBZFLpfdTnSrMOXrvOqoKdEy2wq7wpWbHgVjgGl 6Q4FYwpVmc5fISdeBWCCCcbDzkdm/uMZl90sQeOlJJvb8gfFsuwo4X7azpte8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646516093; a=rsa-sha256; cv=none; b=jkyii2H0ldEf6eA/u2KdWR8BrZ6GH34N9dEBlTA6MOHSzYfVmFAZATGX6I0j5A/V/DjxBw qBzkKfsO4N0mLe/uvEi3f09/4ba21G3TUC5IYTLI8/SbxkzgOer/CMhzsX81Zdc4hHVkHW OElRDxVJ8v0v3lAFFfr6t7XyCyVxuYSGL4TPvyfBbxMSQ7fH9l0HBSODFIb8nXO0stWC2S IV/CnzX0/CEAkQ6COd4UZJtDuaIjZ2NYm/Nya7kvPGC6vDjzGDQkGSqyrqGtMMYgraHEGl ryBPZAkwHCYzJkQVyDKZvGRoajv60+tQQyZfcjJ8mPprvoWWpurq0ymmnwLHTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_0655F321-539A-465B-BB9C-D0EF8E7F9DE6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 5 Mar 2022, at 03:36, Tomoaki AOKI wrote: >=20 > On Fri, 4 Mar 2022 19:25:06 +0100 > Dimitry Andric wrote: >> On 3 Mar 2022, at 21:30, John Baldwin wrote: >>>=20 >>> On 3/3/22 10:08 AM, Dimitry Andric wrote: ... >> For some reason, with the libunwind headers instead, it now gets = shifted >> by 8 bytes. I think we are having a case of kludges upon kludges upon >> hacks, which is now falling apart... :-) >>=20 >> In any case, if I unconditionally enable the "#if defined >> _LIBCPPABI_VERSION // detect libc++abi" block in except.cxx, it does >> detect the exception header successfully, the gengal.bin command does >> not crash anymore, and the whole libreoffice build succeeds. The >> libreoffice binaries even run OK, though I only did light testing, = like >> opening a doc file and messing around with it a little bit. >>=20 >> But I'm not sure if it is the solution we want. Maybe we should again >> put in some sort of compat hack, to make the libunwind/libcxxrt >> combination work for this scenario? (I think libreoffice is one of = the >> few applications that calls __cxa_throw directly, with its own = deleter >> function...) >>=20 >> -Dimitry >>=20 >=20 > Thanks for your hard work! > Maybe, editors/libreoffice should adapt to the change if __UNWIND_H__ > is defined in /usr/include/unwind.h, but if some others (including > not-yet-ported softwares) have the same problem, compat hack on base > would be better preferred. >=20 > If there is a standard way to avoid this (use already-existing wrapper > function?), it would be better fixing editors/libreoffice with some > hints written into porter's handbook. There's something very strange going on here, as evidenced by yet another gdb session: (gdb) frame 2 #2 0x000000082c2e92e7 in __cxa_free_exception = (thrown_exception=3D0x87b5aff00) at = /share/dim/src/freebsd/llvm-14-update/contrib/libcxxrt/exception.cc:627 627 = ex->exceptionDestructor(thrown_exception); (gdb) print thrown_exception $31 =3D (void *) 0x87b5aff00 (gdb) print static_cast<__cxa_exception*>(thrown_exception)-1 $32 =3D (__cxa_exception *) 0x87b5afe88 So according to the spec, casting the void pointer 'thrown_exception' to a __cxa_exception pointer, then subtracting 1, should give you the original __cxa_exception struct. In this case, it subtracts 8 bytes, going from 0x87b5aff00 to 0x87b5afe88. Now I do exactly the same in the libreoffice frame one below, where the incoming void pointer 'pExc' is the previous 'thrown_exception' value: (gdb) frame 1 #1 gcc3::deleteException (pExc=3D0x87b5aff00) at = bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx:139 139 OUString unoName( toUNOname( header->exceptionType->name() ) = ); (gdb) print pExc $33 =3D (void *) 0x87b5aff00 (gdb) print static_cast<__cxa_exception*>(pExc)-1 $34 =3D (__cxa_exception *) 0x87b5afe80 So in *this* function, subtracting 1 from a __cxa_exception pointer subtracts 16 bytes instead, going from 0x87b5aff00 to 0x87b5afe80! I don't know what causes this, except maybe that libreoffice pulls in some different definition of __cxa_exception. It looks like they have their own header for this: = https://cgit.freedesktop.org/libreoffice/core/tree/bridges/source/cpp_uno/= gcc3_linux_x86-64/share.hxx but it's not clear to me whether they are enabling any of these custom declarations... -Dimitry --Apple-Mail=_0655F321-539A-465B-BB9C-D0EF8E7F9DE6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCYiPXcAAKCRCwXqMKLiCW o+CvAJ4onozGounph9uMUWtBQ/iMMeMWnQCfWJ9SNI9eFGX8FwyxS/CrZlARzyc= =9nXp -----END PGP SIGNATURE----- --Apple-Mail=_0655F321-539A-465B-BB9C-D0EF8E7F9DE6--