From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CD9F138708F3; Wed, 8 May 2024 10:56:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD9F138708F3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715165801; bh=dlgIxzTDbpU4nVPkszUrRCAhPc0G2oLcee8+d+XdvNw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TUsFLIYkkxd1dnnqYZobBI9zLArYgq2PcJ2G8Dqn537gwd1d6TkE/8pfQy13sDffU rKCBhNbCTYwotcO4nKr9PWBfeCbDDzLNY3GRVpvNEg9g5Og+hD2nF6GqqCGrzWnfo/ DrdPOwuszGCV6Gb4YCCjf03frdpbWn0iX5fRdE7I= From: "lh_mouse at 126 dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114968] [14/15 Regression] missing `__thiscall` attribute on builtin declaration of `__cxa_thread_atexit()` Date: Wed, 08 May 2024 10:56:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: lh_mouse at 126 dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114968 --- Comment #18 from LIU Hao --- (In reply to Jakub Jelinek from comment #16) > What is the reason behind > /* mingw32 atexit function is safe to use in shared libraries. Use it > to register C++ static destructors. */ > #define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true > ? > Couldn't we just drop that? I think so. We have a statically linked `atexit()` much like glibc [1]. How= ever we have added `__cxa_atexit()` a couple of years ago, so it might be prefer= red. As the Windows system library does not provide `__cxa_*` routines, those functions are also linked statically, so they ignore the DSO handle paramet= er. [1] https://github.com/mingw-w64/mingw-w64/blob/19cf5d171f6df208b27271b40014c66= d2b44e38b/mingw-w64-crt/crt/crtdll.c#L205 [2] https://github.com/mingw-w64/mingw-w64/blob/19cf5d171f6df208b27271b40014c66= d2b44e38b/mingw-w64-crt/crt/cxa_atexit.c#L11 > while with __cxa_atexit one can just pass the destructor itself to the > __cxa_atexit function (indeed with slightly more instructions there becau= se > in addition to the function pointer it needs to pass the address of the > object and __dso_handle). > But it is still smaller. Can `./configure --enable-__cxa_atexit` be safely used? Documentation says = it's only available with glibc [3], but I don't see any stuff specific to glibc. [3] https://gcc.gnu.org/install/configure.html > Anyway, if there is some strong reason to keep it, I think it would be > better to avoid adding yet another GTY tree, the __cxa_throw last argument > type is the same as __cxa_atexit/__cxa_thread_atexit. Maybe it can be kept for backward compatibility.=