From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27637 invoked by alias); 25 Oct 2019 15:47:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 27629 invoked by uid 89); 25 Oct 2019 15:47:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=tentative X-HELO: EUR03-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr50043.outbound.protection.outlook.com (HELO EUR03-VE1-obe.outbound.protection.outlook.com) (40.107.5.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 Oct 2019 15:47:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fvc1KbU7zw3DWKUn288Gz0PmzS9o4HrbPyzW0oTuIlY=; b=JpKfYzAa9YVOlvJyRUiPf/4/vIg4TfMj4odYIdCYAfT2MH7ltZb0oHmL9Zc5UcVPjyUasOaceMldsuTovGIAAHHh4MskaeTQuYajJLW4UTYQ7ryNqUrh0BWBz98f31cZkZOYTPmDxydG1F9zmsR06vqFV+VxHju4266CkfuF50w= Received: from HE1PR0802CA0018.eurprd08.prod.outlook.com (2603:10a6:3:bd::28) by DBBPR08MB4283.eurprd08.prod.outlook.com (2603:10a6:10:c3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.24; Fri, 25 Oct 2019 15:47:18 +0000 Received: from AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::204) by HE1PR0802CA0018.outlook.office365.com (2603:10a6:3:bd::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Fri, 25 Oct 2019 15:47:18 +0000 Authentication-Results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=none action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT031.mail.protection.outlook.com (10.152.16.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20 via Frontend Transport; Fri, 25 Oct 2019 15:47:18 +0000 Received: ("Tessian outbound 851a1162fca7:v33"); Fri, 25 Oct 2019 15:47:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ee7b74c920421bb5 X-CR-MTA-TID: 64aa7808 Received: from 2d14086d0048.1 (cr-mta-lb-1.cr-mta-net [104.47.5.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7533E780-F7D1-496B-BB9B-08822B1BE198.1; Fri, 25 Oct 2019 15:47:12 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02lp2056.outbound.protection.outlook.com [104.47.5.56]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2d14086d0048.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Fri, 25 Oct 2019 15:47:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCM2ItM106m568CZvULr4qHzPqUOfepjNEe30B+t5rZ4z3FkBS6HGpyZj1KqCa9In7Ngu+kqpdGealdoPYJbivl1CZrV/7scR6FEr9qD03bToCPdiMts5508D0Y1Z1M5YarcVn9ERZKFQbldBv1mHc4LNmaxGaOkiWuftzeuZh2BU0VEQNcPCFhAFQdPflzWmeS0VsAqWl76t6RvlcnrmskhCuQn+g034jD5lSOHqW9/Y9bvjevWYQ+gmvf6Gahy2GjbFVKTSjBDGO951l/AfsnB2ZdltjN9t5+RM5rjMEUvILEPtbx1JrWlPwkLcK2XrkpJ4MakMTuCfingFd0hQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fvc1KbU7zw3DWKUn288Gz0PmzS9o4HrbPyzW0oTuIlY=; b=Uy9b36l7/zYWqExYFMrJiQlOMl1Se2W/cTNHlbVDfzwCk+0INKTDxTQS6LiwInu3xbFgyglO+aZbnSchmzuKBz4W+f1nYLIZtWeTkgAfcxVOqzn6OnvOnGHfcikMLRrWb3Z/EUFnq3OpWYDAuswfD9Ql4QWZOc9awCGFH5/X3sfScKoePV3426hcg76IWZ0r08eADr8AmZ2wGN2xLQsF85vmH1g+drUnZdrB7fG6GYjlffO/35bcTcpohxadsUAUoluhJ3NxUjUuqZ2QzFiyCP5VxjXVhDeGh8kCX/YSBESuVBE0l7q9CqOUsgztv6hm78gWbs/kAu2uiVfw6O4mhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fvc1KbU7zw3DWKUn288Gz0PmzS9o4HrbPyzW0oTuIlY=; b=JpKfYzAa9YVOlvJyRUiPf/4/vIg4TfMj4odYIdCYAfT2MH7ltZb0oHmL9Zc5UcVPjyUasOaceMldsuTovGIAAHHh4MskaeTQuYajJLW4UTYQ7ryNqUrh0BWBz98f31cZkZOYTPmDxydG1F9zmsR06vqFV+VxHju4266CkfuF50w= Received: from VI1PR0801MB2127.eurprd08.prod.outlook.com (10.168.62.22) by VI1PR0801MB1885.eurprd08.prod.outlook.com (10.173.71.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2367.24; Fri, 25 Oct 2019 15:47:11 +0000 Received: from VI1PR0801MB2127.eurprd08.prod.outlook.com ([fe80::38cb:bfb8:b869:7cb8]) by VI1PR0801MB2127.eurprd08.prod.outlook.com ([fe80::38cb:bfb8:b869:7cb8%12]) with mapi id 15.20.2387.025; Fri, 25 Oct 2019 15:47:11 +0000 From: Wilco Dijkstra To: GCC Patches CC: nd Subject: [PATCH] PR85678: Change default to -fno-common Date: Fri, 25 Oct 2019 16:00:00 -0000 Message-ID: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:2657;OLM:2657; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(366004)(136003)(396003)(376002)(346002)(39860400002)(199004)(189003)(54534003)(86362001)(99286004)(76116006)(7736002)(66066001)(66446008)(52536014)(64756008)(74316002)(66556008)(2906002)(26005)(7696005)(33656002)(6116002)(102836004)(5660300002)(6506007)(486006)(14454004)(478600001)(476003)(55016002)(186003)(66946007)(66476007)(4001150100001)(8676002)(3846002)(9686003)(316002)(14444005)(71200400001)(6916009)(256004)(81166006)(8936002)(81156014)(71190400001)(6436002)(4326008)(25786009)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0801MB1885;H:VI1PR0801MB2127.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Dx1wnrHBo/oz6ivLq5bA2iMrL1vZESNTMwEfZyA6J2U7Eo2bTEeAXPpdcG720YYDA4wnGglRbFXraAt67eert8V0rqJ0V1XK8uiMidROz+eGdvWe3o7q9ge7Bgv6mu6/esfYyTKOyZPf2KElcIu2JYOHm50uaPUEqXaXgzjjfc6a/LWbjT8AmsxmdFRAWEyzEqJppkf7eJXza63spI7DPRPCXapFj8E2ptUeDTn5wNkecJAOhxdBPTZdXpca/DZTjcdcDaT1VZHm5CzIbc5LaxE6BJHtlmwctQO+xUTYNLFhDX7HdO0h8lzLuEJYPNy31T09VStRejJUjL3YqaF0LGR0TZlHerruNugsBWKZdXriwEeMDiMTmQ+RjdM3AMB5gXVZZOkcCpugv2N0jKO63RQF9RJtCOm1gRqgD/CvlFTouGXZWigRtx25YFPEWrpI x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; Return-Path: Wilco.Dijkstra@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT031.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 0a047f9a-a706-4dfb-4a53-08d759629969 X-SW-Source: 2019-10/txt/msg01848.txt.bz2 GCC currently defaults to -fcommon. As discussed in the PR, this is an anc= ient C feature which is not conforming with the latest C standards. On many tar= gets this means global variable accesses have a codesize and performance penalty. This applies to C code only, C++ code is not affected by -fcommon. It is a= bout time to change the default. OK for commit? ChangeLog 2019-10-25 Wilco Dijkstra PR85678 * common.opt (fcommon): Change init to 1. doc/ * invoke.texi (-fcommon): Update documentation. --- diff --git a/gcc/common.opt b/gcc/common.opt index 0195b0cb85a06dd043fd0412b42dfffddfa2495b..b0840f41a5e480f4428bd62724b= 0dc3d54c68c0b 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1131,7 +1131,7 @@ Common Report Var(flag_combine_stack_adjustments) Opt= imization Looks for opportunities to reduce stack adjustments and stack references. =20 fcommon -Common Report Var(flag_no_common,0) +Common Report Var(flag_no_common,0) Init(1) Put uninitialized globals in the common section. =20 fcompare-debug diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 857d9692729e503657d0d0f44f1f6252ec90d49a..5b4ff66015f5f94a5bd89e4dc3d= 2d53553cc091e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -568,7 +568,7 @@ Objective-C and Objective-C++ Dialects}. -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol -fasynchronous-unwind-tables @gol -fno-gnu-unique @gol --finhibit-size-directive -fno-common -fno-ident @gol +-finhibit-size-directive -fcommon -fno-ident @gol -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol -fno-jump-tables @gol -frecord-gcc-switches @gol @@ -14050,35 +14050,27 @@ useful for building programs to run under WINE@. code that is not binary compatible with code generated without that switch. Use it to conform to a non-default application binary interface. =20 -@item -fno-common -@opindex fno-common +@item -fcommon @opindex fcommon +@opindex fno-common @cindex tentative definitions -In C code, this option controls the placement of global variables=20 -defined without an initializer, known as @dfn{tentative definitions}=20 -in the C standard. Tentative definitions are distinct from declarations=20 +In C code, this option controls the placement of global variables +defined without an initializer, known as @dfn{tentative definitions} +in the C standard. Tentative definitions are distinct from declarations of a variable with the @code{extern} keyword, which do not allocate storag= e. =20 -Unix C compilers have traditionally allocated storage for -uninitialized global variables in a common block. This allows the -linker to resolve all tentative definitions of the same variable +The default is @option{-fno-common}, which specifies that the compiler pla= ces +uninitialized global variables in the BSS section of the object file. +This inhibits the merging of tentative definitions by the linker so you ge= t a +multiple-definition error if the same variable is accidentally defined in = more +than one compilation unit. + +The @option{-fcommon} places uninitialized global variables in a common bl= ock. +This allows the linker to resolve all tentative definitions of the same va= riable in different compilation units to the same object, or to a non-tentative -definition.=20=20 -This is the behavior specified by @option{-fcommon}, and is the default fo= r=20 -GCC on most targets.=20=20 -On the other hand, this behavior is not required by ISO -C, and on some targets may carry a speed or code size penalty on -variable references. - -The @option{-fno-common} option specifies that the compiler should instead -place uninitialized global variables in the BSS section of the object file. -This inhibits the merging of tentative definitions by the linker so -you get a multiple-definition error if the same=20 -variable is defined in more than one compilation unit. -Compiling with @option{-fno-common} is useful on targets for which -it provides better performance, or if you wish to verify that the -program will work on other systems that always treat uninitialized -variable definitions this way. +definition. This behavior does not conform to ISO C, is inconsistent with= C++, +and on many targets implies a speed and code size penalty on global variab= le +references. It is mainly useful to enable legacy code to link without err= ors. =20 @item -fno-ident @opindex fno-ident