From: Doug Goldstein Date: Tue, 13 Mar 2018 04:06:51 +0000 (-0500) Subject: tools: detect appropriate debug optimization level X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~414 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b43501451733193b265de30fd79a764363a2a473;p=xen.git tools: detect appropriate debug optimization level 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 Acked-by: Wei Liu --- 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 # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=. PY_CFLAGS += $(PY_NOOPT_CFLAGS) else