From: "Jan Beulich" Subject: Re: [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE Date: Thu, 05 Feb 2015 16:52:31 +0000 Message-ID: <54D3ADDF020000780005D7A1@mail.emea.novell.com> References: <20150205154753.GF3823@citrix.com> <1423154167-22453-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJPfM-0000qp-Np for xen-devel@lists.xenproject.org; Thu, 05 Feb 2015 16:52:32 +0000 In-Reply-To: <1423154167-22453-1-git-send-email-ian.jackson@eu.citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Wei Liu , Ian Campbell , Stefano Stabellini , Don Slutz , Euan Harris , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 05.02.15 at 17:36, wrote: > Some systems have python-config include -D_FORTIFY_SOURCE in the > CFLAGS. But -D_FORTIFY_SOURCE does not (currently) work with -O0, and > -O0 is enabled in debug builds (since 1166ecf781). As a result, on > those systems, debug builds fail. > > Work around this problem as follows: > * In configure, detect -D_FORTIFY_SOURCE in $(python-config --cflags) > * If detected, set the new autoconf substitution and make variable > PY_NOOPT_CFLAGS to -O1. > * In tools/Rules.mk, where we add -O0, also add PY_NOOPT_CFLAGS > (which will override the -O0 with -O1 if required). Not having tried it out yet (hopefully some time tomorrow), two a remark and a question: > --- /dev/null > +++ b/m4/python_fortify_noopt.m4 > @@ -0,0 +1,29 @@ > +dnl Defines PY_NOOPT_CFLAGS to either '' or -O1 > +dnl > + > +dnl This is necessary because on some systems setup.py includes > +dnl -D_FORTIFY_SOURCE but have a -D_FORTIFY_SOURCE which breaks > +dnl with -O0. On those systems we arrange to use -O1 for debug > +dnl builds instead. > + > +AC_DEFUN([AX_CHECK_PYTHON_FORTIFY_NOOPT], [ > + AC_CACHE_CHECK([whether Python setup.py brokenly enables -D_FORTIFY_SOURCE], I guess the people having added that would not like to see this called "brokenly". > --- a/tools/Rules.mk > +++ b/tools/Rules.mk > @@ -56,7 +56,7 @@ SHLIB_libxenvchan = -Wl,-rpath-link=$(XEN_LIBVCHAN) > > ifeq ($(debug),y) > # Disable optimizations and enable debugging information for macros > -CFLAGS += -O0 -g3 > +CFLAGS += -O0 -g3 $(PY_NOOPT_CFLAGS) Why would you do this for all of the tools build rather than just the python components? Jan