]> xenbits.xensource.com Git - people/tklengyel/xen.git/commitdiff
tools: Use -Og for debug builds when available
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 11 Feb 2021 14:22:44 +0000 (14:22 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 19 Feb 2021 17:10:33 +0000 (17:10 +0000)
The recommended optimisation level for debugging is -Og, and is what tools
such as gdb prefer.  In practice, it equates to -01 with a few specific
optimisations turned off.

abi-dumper in particular wants the libraries it inspects in this form.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Jackson <iwj@xenproject.org>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/Rules.mk

index f61da81f4ad9caed2aa3f2721125e606c9d4b74a..2907ed2d3972475f4331a710268a4b28d170677f 100644 (file)
@@ -106,8 +106,9 @@ endif
 CFLAGS_libxenlight += $(CFLAGS_libxenctrl)
 
 ifeq ($(debug),y)
-# Disable optimizations
-CFLAGS += -O0 -fno-omit-frame-pointer
+# Use -Og if available, -O0 otherwise
+dbg_opt_level := $(call cc-option,$(CC),-Og,-O0)
+CFLAGS += $(dbg_opt_level) -fno-omit-frame-pointer
 # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=<n>.
 PY_CFLAGS += $(PY_NOOPT_CFLAGS)
 else