All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC
@ 2018-11-16 11:26 Alexey Brodkin
  2018-11-29 21:14 ` Thomas Petazzoni
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Brodkin @ 2018-11-16 11:26 UTC (permalink / raw)
  To: buildroot

This is what GCC manual says [1]:
-------------------------->8----------------------
--enable-__cxa_atexit

    Define if you want to use __cxa_atexit, rather than atexit,
    to register C++ destructors for local statics and global objects.

    This is essential for fully standards-compliant handling of destructors,
    but requires __cxa_atexit in libc.

    This option is currently only available on systems with GNU libc
    ...
-------------------------->8----------------------

Important disadvantages of a simple atexit() are that [2]:
-------------------------->8----------------------
1999 C Standard only requires that the implementation support 32
registered functions, although most implementations support many more.

More important it does not deal at all with the ability in most implementations
to remove DSOs from a running program image by calling dlclose
prior to program termination.
-------------------------->8----------------------

Also it seems like all libc's we support in Buildroot (Glibc, uClibc and musl)
support __cxa_at_exit() so enable it unconditionally.

FWIW if we look around we'll see:
 1. In OpenEmbedded it is enabled for everything except gcc-cross-initial: [3], [4]
 2. In Crosstool-NG it is enabled by default: [5]
 3. In OpenWrt it is disabled only for uClibc, otherwise enabled: [6]

So I think we should be good with it as well.

[1] https://gcc.gnu.org/install/configure.html
[2] https://itanium-cxx-abi.github.io/cxx-abi/abi.html#dso-dtor-motivation
[3] https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-devtools/gcc/gcc-configure-common.inc#L59
[4] https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-devtools/gcc/gcc-cross-initial.inc#L23
[5] https://github.com/crosstool-ng/crosstool-ng/blob/master/config/cc/gcc.in#L270
[6] https://github.com/openwrt/openwrt/blob/master/toolchain/gcc/common.mk#L170

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Nicolas Cavallari <Nicolas.Cavallari@green-communications.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Mark Corbin <mark.corbin@embecosm.com>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
Cc: Claudiu Zissulescu <claziss@synopsys.com>
Cc: Cupertino Miranda <cmiranda@synopsys.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---

Changes v1 -> v2:

 * Added references to other buildsystems in commit message
 * Dropped disable in gcc-initial so we have it enabled always

 package/gcc/gcc.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index e47435677e..5901624ea5 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -87,7 +87,7 @@ HOST_GCC_COMMON_DEPENDENCIES = \
 HOST_GCC_COMMON_CONF_OPTS = \
 	--target=$(GNU_TARGET_NAME) \
 	--with-sysroot=$(STAGING_DIR) \
-	--disable-__cxa_atexit \
+	--enable-__cxa_atexit \
 	--with-gnu-ld \
 	--disable-libssp \
 	--disable-multilib \
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC
  2018-11-16 11:26 [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC Alexey Brodkin
@ 2018-11-29 21:14 ` Thomas Petazzoni
  2019-01-21 15:04   ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-11-29 21:14 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 16 Nov 2018 14:26:18 +0300, Alexey Brodkin wrote:
> This is what GCC manual says [1]:
> -------------------------->8----------------------  
> --enable-__cxa_atexit

I've applied to next, but after dropping the "for final GCC" from the
commit title, since cxa_atexit is now used for both the initial gcc and
the final gcc.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC
  2018-11-29 21:14 ` Thomas Petazzoni
@ 2019-01-21 15:04   ` Fabio Estevam
  2019-01-21 20:51     ` Peter Seiderer
  2019-02-24 21:20     ` Peter Korsgaard
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2019-01-21 15:04 UTC (permalink / raw)
  To: buildroot

Hi Peter,

On Thu, Nov 29, 2018 at 7:15 PM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> Hello,
>
> On Fri, 16 Nov 2018 14:26:18 +0300, Alexey Brodkin wrote:
> > This is what GCC manual says [1]:
> > -------------------------->8----------------------
> > --enable-__cxa_atexit
>
> I've applied to next, but after dropping the "for final GCC" from the
> commit title, since cxa_atexit is now used for both the initial gcc and
> the final gcc.

Could this one be applied to Buildroot stable?

The lack of this patch causes is causing issues on Mesa:
https://www.mail-archive.com/mesa-dev at lists.freedesktop.org/msg212440.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC
  2019-01-21 15:04   ` Fabio Estevam
@ 2019-01-21 20:51     ` Peter Seiderer
  2019-02-24 21:20     ` Peter Korsgaard
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Seiderer @ 2019-01-21 20:51 UTC (permalink / raw)
  To: buildroot

Hello *,

On Mon, 21 Jan 2019 13:04:46 -0200, Fabio Estevam <festevam@gmail.com> wrote:

> Hi Peter,
> 
> On Thu, Nov 29, 2018 at 7:15 PM Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
> >
> > Hello,
> >
> > On Fri, 16 Nov 2018 14:26:18 +0300, Alexey Brodkin wrote:  
> > > This is what GCC manual says [1]:  
> > > -------------------------->8----------------------  
> > > --enable-__cxa_atexit  
> >
> > I've applied to next, but after dropping the "for final GCC" from the
> > commit title, since cxa_atexit is now used for both the initial gcc and
> > the final gcc.  
> 
> Could this one be applied to Buildroot stable?

+1

> 
> The lack of this patch causes is causing issues on Mesa:
> https://www.mail-archive.com/mesa-dev at lists.freedesktop.org/msg212440.html

Did re-run the same buildroot-2018.11/mesa/etnaviv test, could confirm enabling
__cxa_atexit fixes the mesa double-free on exit...

Regards,
Peter
  
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC
  2019-01-21 15:04   ` Fabio Estevam
  2019-01-21 20:51     ` Peter Seiderer
@ 2019-02-24 21:20     ` Peter Korsgaard
  1 sibling, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2019-02-24 21:20 UTC (permalink / raw)
  To: buildroot

>>>>> "Fabio" == Fabio Estevam <festevam@gmail.com> writes:

 > Hi Peter,
 > On Thu, Nov 29, 2018 at 7:15 PM Thomas Petazzoni
 > <thomas.petazzoni@bootlin.com> wrote:
 >> 
 >> Hello,
 >> 
 >> On Fri, 16 Nov 2018 14:26:18 +0300, Alexey Brodkin wrote:
 >> > This is what GCC manual says [1]:
 >> > -------------------------->8----------------------
 >> > --enable-__cxa_atexit
 >> 
 >> I've applied to next, but after dropping the "for final GCC" from the
 >> commit title, since cxa_atexit is now used for both the initial gcc and
 >> the final gcc.

 > Could this one be applied to Buildroot stable?

 > The lack of this patch causes is causing issues on Mesa:
 > https://www.mail-archive.com/mesa-dev at lists.freedesktop.org/msg212440.html

Yes, sorry for the delay - Committed to 2018.02.x and 2018.11.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-24 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16 11:26 [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC Alexey Brodkin
2018-11-29 21:14 ` Thomas Petazzoni
2019-01-21 15:04   ` Fabio Estevam
2019-01-21 20:51     ` Peter Seiderer
2019-02-24 21:20     ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.