[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tools: work around collision of -O0 and -D_FORTIFY_SOURCE



>>> On 05.02.15 at 17:36, <ian.jackson@xxxxxxxxxxxxx> 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.