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: Tue, 8 Mar 2016 10:34:42 -0600 Message-ID: <56DEFF22.80004@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> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5429107704317083248==" Return-path: In-Reply-To: <20160308153847.GF31271@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) --===============5429107704317083248== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qWr8o1kE2OcO0xllPLfHfcSenaRuifiLj" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qWr8o1kE2OcO0xllPLfHfcSenaRuifiLj Content-Type: multipart/mixed; boundary="UDK2NgexhlWVAOnARg8KMp1i3U6US8Bne" From: Doug Goldstein To: Wei Liu Cc: xen-devel@lists.xen.org, Ian Jackson , Stefano Stabellini , euan.harris@citrix.com Message-ID: <56DEFF22.80004@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> In-Reply-To: <20160308153847.GF31271@citrix.com> --UDK2NgexhlWVAOnARg8KMp1i3U6US8Bne Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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. There= >=20 > 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 wa= y. 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 reduce= the duplication of CFLAGS that are passed on the command line of builds. >=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. = 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 -O= 0 >=20 > 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 > Not that I disagree with this patch in general, but the commit message > 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. >=20 >> in 1166ecf781b1016eaa61f8d5ba4fb1fde9d599b6. >> >=20 > 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. >=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_SOU= RCE=3D. >> PY_CFLAGS +=3D $(PY_NOOPT_CFLAGS) >> endif >> --=20 >> 2.4.10 >> --=20 Doug Goldstein --UDK2NgexhlWVAOnARg8KMp1i3U6US8Bne-- --qWr8o1kE2OcO0xllPLfHfcSenaRuifiLj 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 iQJ8BAEBCgBmBQJW3v8kXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRBNTM5MEQ2RTNFMTkyNzlCNzVDMzIwOTVB MkJDMDNEQzg3RUQxQkQ0AAoJEKK8A9yH7RvUC7AP/iei+iFknJEylMW3xAZ2UQFc pPNAJXSjWPSabu6ThdABxbHunESLUzNm9Kk5AX1r5nR01fvOOT6T9i2PpF9x9CXe xOkUGfjiRKCTq2WiLLZo+Xg+fRySkXaoEOPdcSxYZnzqciI3M4hM9lLi6/4zWQvI ddKYd29Ku0tNUQcDlwg5Uj/NbaHXXJPx/xf7z0Y+zaDmvE0Vn89Wx1+QXaZst6o9 ZutfkBpAbdq7n49d4i0LLwLtkoJafJLOc5p4todkm/4x81rAN/GaJtZc6QrC8L2a UvxwklW7yjcMKoTgiHSh3ElaKNZpqVs+toJs6K6/Xg+DqLKpwAJu2O2jXAAXAlbe 9MfgXiM/5/nr8Ehe9UbnaojOGNczdaznBwGU8QCZdseu5SvVMKsM+r2slIlTgkiD NbdCbOmW8uBTwRpxnAipE8aWZNHkKelu9ILjP+/wazNtOzJsM9kg8ghH3IuBnjs/ BJbeYWKSq6uGaX2s9Oc9qkqgXStwxu5SUS9Hko/yJ45Lx4/O69LbLLAiGPokJTom tGqzP9mmp77rSyYAGa1QW3ebZ0sokbgVzfYx2xV2mN6wxFmab38sivEVNV1bcmYh TuC3LJEw2EJLcVHggTEZ8TDVZZ0ca5kky3K7iJftTFnpSkRTu3HVveQ2R+Jexs3m VajMMYa1dlazZqVOOuxw =0lme -----END PGP SIGNATURE----- --qWr8o1kE2OcO0xllPLfHfcSenaRuifiLj-- --===============5429107704317083248== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============5429107704317083248==--