From patchwork Fri Nov 16 11:26:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 998900 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="Sh45cWnh"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42xGCL12p1z9s0t for ; Fri, 16 Nov 2018 22:26:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 89CC18727B; Fri, 16 Nov 2018 11:26:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cV--aGRhySro; Fri, 16 Nov 2018 11:26:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id C1E858654E; Fri, 16 Nov 2018 11:26:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 7B43B1C28DD for ; Fri, 16 Nov 2018 11:26:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 77E4E87C5F for ; Fri, 16 Nov 2018 11:26:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uBadE1xZJMrV for ; Fri, 16 Nov 2018 11:26:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay.synopsys.com [198.182.47.9]) by whitealder.osuosl.org (Postfix) with ESMTPS id D5C7487C50 for ; Fri, 16 Nov 2018 11:26:29 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 2A92124E0F92; Fri, 16 Nov 2018 03:26:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1542367589; bh=C9O4lg2+3h16uRCfehRy1/s+78/gHlEZQrT3gyn4cmY=; h=From:To:Cc:Subject:Date:From; b=Sh45cWnh87qP+yykmcKB60NYtoT6CZk0ENRHcInSjBQA42aJq4mbmtDXyaFmYzoCr oqxFDhvAAj9okxTjqi5OxdOf8ukfL/OKbZ9TR7Fu742nZEfw4CmJsbLTcn8K0EvCus kXL9OTVpIhVQFK7wL02VQb1te3L7A+ldqq+b+QiO5jtYbVmoYjcCh32i5KeMpEtm7d 6TotSEK8CL4ySK64CIcSbenXKm+Fb3Zkdy6reejcXUfQDyTMCmcBiiFI7BttY3moaq 18SkSSCSb4b0rlsBhsJKVyhn0ICyAjwe1e5kMJmgI+ERHPUVwFX46E8OiX3dhtXZTM HIxBBN30ADhTQ== Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id B15C636C0; Fri, 16 Nov 2018 03:26:24 -0800 (PST) From: Alexey Brodkin To: buildroot@busybox.net Date: Fri, 16 Nov 2018 14:26:18 +0300 Message-Id: <20181116112618.17034-1-abrodkin@synopsys.com> X-Mailer: git-send-email 2.16.2 Subject: [Buildroot] [PATCH v2] gcc: Enable __cxa_atexit for final GCC X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bernd Kuhls , Cupertino Miranda , Peter Korsgaard , ARC Buildroot mailing list , Mark Corbin , Alexey Brodkin , Thomas Petazzoni , Romain Naour , Vineet Gupta , Claudiu Zissulescu MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "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 Cc: Nicolas Cavallari Cc: Thomas Petazzoni Cc: Mark Corbin Cc: Romain Naour Cc: Peter Korsgaard Cc: Bernd Kuhls Cc: Claudiu Zissulescu Cc: Cupertino Miranda Cc: Vineet Gupta Reviewed-by: Arnout Vandecappelle (Essensium/Mind) --- 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 \