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: Wed, 16 Mar 2016 14:14:34 -0500 Message-ID: <56E9B09A.3020808@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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6066966363554503712==" Return-path: In-Reply-To: <20160308165040.GR31271@citrix.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) --===============6066966363554503712== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Sg7HXSADCCUivjMOTm0cqxRUrd0hDjhBG" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Sg7HXSADCCUivjMOTm0cqxRUrd0hDjhBG Content-Type: multipart/mixed; boundary="c5Iu8ROj5fg6r1g047xJaiW3FTGQwpMJf" From: Doug Goldstein To: Wei Liu Cc: xen-devel@lists.xen.org, Ian Jackson , Stefano Stabellini , euan.harris@citrix.com Message-ID: <56E9B09A.3020808@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> In-Reply-To: <20160308165040.GR31271@citrix.com> --c5Iu8ROj5fg6r1g047xJaiW3FTGQwpMJf Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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. The= re >>> >>> 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 same= way. >> >=20 > Urgh... >=20 >> This came about from reading reports on the -devel and -user's ML that= >> were solved by building Xen with debug=3Dn. I was also striving to red= uce >> the duplication of CFLAGS that are passed on the command line of build= s. >> >=20 > I agree this is a good idea. >=20 >>> >>>> 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 away= =2E The >>>> preferred route should be to use -Og if its available, otherwise use= >>>> -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). >> >=20 > OK. I thought you're talking about something in the manual. >=20 >>> >>> Not that I disagree with this patch in general, but the commit messag= e >>> seems a bit misleading. >> >> I can rewrite it. I'd also be willing to change the patch to prefer -O= g >> if its available and use -O0 if its not. >> >=20 > No need to do it now because ... >=20 >>> >>>> in 1166ecf781b1016eaa61f8d5ba4fb1fde9d599b6. >>>> >>> >>> And I have no idea why -O1 confuses the debugger so I've CC'ed Euan f= or >>> more input. >> >> -O1 can optimize things out when you look at them with gdb but -Og is >> suppose to do the right thing. >> >=20 > .. I don't know much about gcc so I would like to wait for Ian to give > some input. >=20 > Wei. >=20 >>> >>>> 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) -Wl= ,-rpath-link=3D$(XEN_LIBVCHAN) >>>> =20 >>>> ifeq ($(debug),y) >>>> # Disable optimizations and enable debugging information for macros= >>>> -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_S= OURCE=3D. >>>> PY_CFLAGS +=3D $(PY_NOOPT_CFLAGS) >>>> endif >>>> --=20 >>>> 2.4.10 >>>> >> >> >> --=20 >> Doug Goldstein >> >=20 >=20 >=20 ping? --=20 Doug Goldstein --c5Iu8ROj5fg6r1g047xJaiW3FTGQwpMJf-- --Sg7HXSADCCUivjMOTm0cqxRUrd0hDjhBG 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 iQJ7BAEBCgBmBQJW6bCcXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNTM5MEQ2RTNFMTkyNzlCNzVDMzIwOTVB MkJDMDNEQzg3RUQxQkQ0AAoJEKK8A9yH7RvU+2QP+IS0UjKK7f66IdsQOxp3ntj9 MP4mw+jvrXA10as1Bg9+OlHVxShecTZpIw291TA1XNJGiI2mUiCBpsjVZJzSRNgU KN5w3JRlPkKNm7+t7Wf+Fxb2aG0mdrzYlchs1CfGTkWOwZDxnpB1Za4dARqyDVbp kwc8TjRdcQhOI8NcrHn1MoO4EuEzmH2OAkvK00xK0FvrTF+3zGFBuv8uSq4hIo6r yus8f16LIVZG2EVHA+aTqcMg23FO4MV9ZEptBD0PV4J9DQKOHM9e4r88hN6sedEq 4zVG6CMJEf4cvsiQ4trkTJu70stFvWAViSjcIxW/28DGQZYrD14rCwLRmk39/Ej4 SDAUDQqNzb40oOfnaIN72P+0BEW1nvF3mblRAz0JsTR7+2jdGMxnL4VaDX2QO8Q7 irwsxT4fB3TnZzIyzTB2bAVYyCbDqgQOxicDSDIyek39ZaN+nMqf/lsw2xc8MZh0 GbnBMHCp/Qty+yr1bxmGM90KrBhkz9rYmst2gHSDRb5H8Dqw01hA99QwSl9igZiF NPX8Yub8grmPyfCp/grFc6FQrfkv9EcyYmu6yZPT8GMABzX7zTKJmOLgq3s94wAi wzWad8eF706vylJrXv4fmLC/D4Ha/rBRTB7ebjHDCqoQjOtIla6IGT6bGjp2qbVY mw4dPoyh93lOc9HrIcs= =MhEB -----END PGP SIGNATURE----- --Sg7HXSADCCUivjMOTm0cqxRUrd0hDjhBG-- --===============6066966363554503712== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============6066966363554503712==--