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

Re: [Xen-devel] [PATCH v4] tools: detect appropriate debug optimization level



On Mon, Mar 12, 2018 at 11:06:51PM -0500, Doug Goldstein wrote:
> When building debug use -Og as the optimization level if its available,
> otherwise retain the use of -O0. -Og has been added by GCC to enable all
> optimizations that to not affect debugging while retaining full
> debugability.
> 
> Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx>
> ---
>  tools/Rules.mk | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/Rules.mk b/tools/Rules.mk
> index 296b722372..3848bcf1f7 100644
> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -164,8 +164,13 @@ LDLIBS_libxenvchan = $(SHDEPS_libxenvchan) 
> $(XEN_LIBVCHAN)/libxenvchan$(libexten
>  SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_LIBVCHAN)
>  
>  ifeq ($(debug),y)
> -# Disable optimizations
> -CFLAGS += -O0 -fno-omit-frame-pointer
> +CFLAGS += -fno-omit-frame-pointer
> +# Use optimizations compatible with debugging otherwise disable optimizations
> +ifneq ($(call cc-option,$(CC),-Og,n),n)
> +CFLAGS += -Og
> +else
> +CFLAGS += -O0
> +endif

Sadly the way cc-option is written made the support check always
return true. cc-option would grep for -Og in the (error) to tell if
it is supported or not, but the error message for -Og doesn't contain
"-Og". It is like 

  cc1: error: argument to '-O' should be a non-negative integer

We need to think of another way to test it, or we just have to live with
V1.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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