From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Goldstein Subject: Re: [PATCH 2/2] tools: detect appropriate debug optimization level Date: Mon, 28 Mar 2016 10:01:16 -0500 Message-ID: <56F9473C.9090508@cardoe.com> References: <1457403820-2949-1-git-send-email-cardoe@cardoe.com> <1457403820-2949-2-git-send-email-cardoe@cardoe.com> <20160308153847.GF31271@citrix.com> <56DEFF22.80004@cardoe.com> <20160308165040.GR31271@citrix.com> <56E9B09A.3020808@cardoe.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8872343799173876393==" Return-path: In-Reply-To: <56E9B09A.3020808@cardoe.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Wei Liu Cc: euan.harris@citrix.com, Stefano Stabellini , Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============8872343799173876393== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xCQbnvmrPtHe1EqbTr2TrLpsQ3TK4G9tp" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xCQbnvmrPtHe1EqbTr2TrLpsQ3TK4G9tp Content-Type: multipart/mixed; boundary="x8SDKqOIo63gXI5qOVG508ixMhwcEHvqw" From: Doug Goldstein To: Wei Liu Cc: xen-devel@lists.xen.org, Ian Jackson , Stefano Stabellini , euan.harris@citrix.com Message-ID: <56F9473C.9090508@cardoe.com> Subject: Re: [PATCH 2/2] tools: detect appropriate debug optimization level References: <1457403820-2949-1-git-send-email-cardoe@cardoe.com> <1457403820-2949-2-git-send-email-cardoe@cardoe.com> <20160308153847.GF31271@citrix.com> <56DEFF22.80004@cardoe.com> <20160308165040.GR31271@citrix.com> <56E9B09A.3020808@cardoe.com> In-Reply-To: <56E9B09A.3020808@cardoe.com> --x8SDKqOIo63gXI5qOVG508ixMhwcEHvqw Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 3/16/16 2:14 PM, Doug Goldstein wrote: > On 3/8/16 10:50 AM, Wei Liu wrote: >> On Tue, Mar 08, 2016 at 10:34:42AM -0600, Doug Goldstein wrote: >>> On 3/8/16 9:38 AM, Wei Liu wrote: >>>> On Mon, Mar 07, 2016 at 08:23:40PM -0600, Doug Goldstein wrote: >>>>> The build should not use -O0 as that results in miscompilations. Th= ere >>>> >>>> This needs some (concrete) references. Is that a known issue in gcc?= If >>>> so can you reference the bug number? >>> >>> So its not really a bug in GCC but just the complete lack of >>> optimizations in play. inlines aren't inlined. dead code elimination >>> isn't run so things are much bigger. structures aren't padded the sam= e way. >>> >> >> Urgh... >> >>> This came about from reading reports on the -devel and -user's ML tha= t >>> were solved by building Xen with debug=3Dn. I was also striving to re= duce >>> the duplication of CFLAGS that are passed on the command line of buil= ds. >>> >> >> I agree this is a good idea. >> >>>> >>>>> have been a few instances on the ML where users were told to switch= >>>>> from -O0 to -O1 or -O2 or to set debug=3Dn and their issue went awa= y. The >>>>> preferred route should be to use -Og if its available, otherwise us= e >>>>> -O1 which is the default. This change undoes the change from -O1 to= -O0 >>>> >>>> gcc manual says -O0 is the default. >>> >>> I wasn't clear about where the 'the default' came from. That's the >>> default in the Xen tree (see: config/StdGNU.mk for example but every >>> platform has -O1 set). >>> >> >> OK. I thought you're talking about something in the manual. >> >>>> >>>> Not that I disagree with this patch in general, but the commit messa= ge >>>> seems a bit misleading. >>> >>> I can rewrite it. I'd also be willing to change the patch to prefer -= Og >>> if its available and use -O0 if its not. >>> >> >> No need to do it now because ... >> >>>> >>>>> in 1166ecf781b1016eaa61f8d5ba4fb1fde9d599b6. >>>>> >>>> >>>> And I have no idea why -O1 confuses the debugger so I've CC'ed Euan = for >>>> more input. >>> >>> -O1 can optimize things out when you look at them with gdb but -Og is= >>> suppose to do the right thing. >>> >> >> .. I don't know much about gcc so I would like to wait for Ian to give= >> some input. >> >> Wei. >> >>>> >>>>> Signed-off-by: Doug Goldstein >>>>> --- >>>>> CC: Ian Jackson >>>>> CC: Stefano Stabellini >>>>> CC: Wei Liu >>>>> --- >>>>> tools/Rules.mk | 3 ++- >>>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/tools/Rules.mk b/tools/Rules.mk >>>>> index 9ef0b47..ae6b01f 100644 >>>>> --- a/tools/Rules.mk >>>>> +++ b/tools/Rules.mk >>>>> @@ -137,7 +137,8 @@ SHLIB_libxenvchan =3D $(SHDEPS_libxenvchan) -W= l,-rpath-link=3D$(XEN_LIBVCHAN) >>>>> =20 >>>>> ifeq ($(debug),y) >>>>> # Disable optimizations and enable debugging information for macro= s >>>>> -CFLAGS +=3D -O0 -g3 >>>>> +$(call cc-option-add,CFLAGS,CC,-Og) >>>>> +CFLAGS +=3D -g3 >>>>> # But allow an override to -O0 in case Python enforces -D_FORTIFY_= SOURCE=3D. >>>>> PY_CFLAGS +=3D $(PY_NOOPT_CFLAGS) >>>>> endif >>>>> --=20 >>>>> 2.4.10 >>>>> >>> >>> >>> --=20 >>> Doug Goldstein >>> >> >> >> >=20 > ping? >=20 >=20 ping the ping? --=20 Doug Goldstein --x8SDKqOIo63gXI5qOVG508ixMhwcEHvqw-- --xCQbnvmrPtHe1EqbTr2TrLpsQ3TK4G9tp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0 iQJ7BAEBCgBmBQJW+Uc/XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNTM5MEQ2RTNFMTkyNzlCNzVDMzIwOTVB MkJDMDNEQzg3RUQxQkQ0AAoJEKK8A9yH7RvU7BcP91QTM+cBeGAav5/fEd5gYV+K GViIWnLAjju7Gz5817VOqNcE8Vsd0DkEkMs0VsPrXBoaUG0xUJ+8t1sw/p0rdJHV RUKEB5FqCFh+T42FujGzGIFEcSafNSCwExMayahVXrQU0B19fV3RpmxTc59HlLdY LWkwksEwZ3BquHCslh9oWBbNEbOpqFxQ+NV7LLE6I4+DC/Eo2Z7s19XMvyqT0b/r UZHZeuwrBzngXV81ctRDLozPrXTseBqF2U2XoHZdvslBLYB52tVg0usbvOxKnkZs 5of5m0UUeCTYFYvKYrB3cm0tR9LgDNYqlx1j3G+PGeGYfMxcd1RNB/jEOeVRk4Vz DL2GYhrbmz6vucJFtgGPPR8YyQ2IsbQT+pCzz47suX7D9pOH8I3mx2buI+E6TN50 o+72tjSmvuEMaqKsPJQFS/dtXGostz5uTwMUj0yJlfiqfSeHU8FGT7Bnxw5Xobpn 3xX+VM3MAtsfWf1MnllJPnhuZ0EcuoHyLqGhGovlwPRzCFEiFLWvDF2bI9+Y2nTQ LfYZs8HJ5yFrmW5v75HUA9bEkWwXSPdxbCQcJ0YfIl5iU7Y0nNqwxo8QJXPMWdNX r8ZMxSbsN9MLjhlzcmDEVOidgTbtlSCVEpnZL2GUjRlDxbb2jki8vjcVT1rVzRrh 4lZteoTTKrnv5Rf5nHE= =ryej -----END PGP SIGNATURE----- --xCQbnvmrPtHe1EqbTr2TrLpsQ3TK4G9tp-- --===============8872343799173876393== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============8872343799173876393==--