]> xenbits.xensource.com Git - xen.git/commitdiff
build: make debug option affect tools only
authorWei Liu <wei.liu2@citrix.com>
Mon, 31 Oct 2016 17:42:25 +0000 (17:42 +0000)
committerWei Liu <wei.liu2@citrix.com>
Thu, 3 Nov 2016 10:40:39 +0000 (10:40 +0000)
The debug option in Config.mk affects hypervisor, tools and stubdom by
appending different flags to CFLAGS.  Mini-os under extra is not
affected because it already has its own build system when it is
separated from xen.git.

It is undesirable because now hypervisor build is affected by both
Kconfig and debug.

Disentangle the semantics of debug by pushing relevant options to
individual sub-systems.

For hypervisor, the flags previously added by debug option is now
controlled by CONFIG_DEBUG.

For tools, flags are moved from config/*.mk into tools/Rules.mk.

For stubdom, because it unilaterally sets debug=y before including
top-level Config.mk, we only need to move the debug build set of flags
into stubdom Makefile.

Specifically there are some considerations on what flags are picked:

1. we don't need -fno-optimize-sibling-calls anymore because gcc doc
   indicates that it is not enabled for -O1, which we already set in the
   debug build.
2. for tools we use -O0 -g3 in Rules.mk because they already take
   precedence over the flags set in config/*.mk.
3. for hypervisor we don't add -fno-omit-frame-pointer to debug build
   because that's controlled by CONFIG_FRAME_POINTER.

This patch doesn't intend to tune those flags, but to provide identical
set of effective flags as before.  The debug option in Config.mk will
only affect tools components after this patch is applied.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
config/StdGNU.mk
config/SunOS.mk
stubdom/Makefile
tools/Rules.mk
xen/Rules.mk

index 39d36b298b8dec73cb11b7984ae011cedd97cf5d..6be823320507e7f43c76092fc9ba643093145286 100644 (file)
@@ -35,14 +35,6 @@ UTIL_LIBS = -lutil
 SONAME_LDFLAG = -soname
 SHLIB_LDFLAGS = -shared
 
-ifneq ($(debug),y)
-CFLAGS += -O2 -fomit-frame-pointer
-else
-# Less than -O1 produces bad code and large stack frames
-CFLAGS += -O1 -fno-omit-frame-pointer
-CFLAGS-$(gcc) += -fno-optimize-sibling-calls
-endif
-
 ifeq ($(lto),y)
 CFLAGS += -flto
 LDFLAGS-$(clang) += -plugin LLVMgold.so
index 86a384d94685c0b3dd9723170a885414e567f374..0fe5f45590ad95aaa7adb5a349e10c4638f6ce94 100644 (file)
@@ -31,12 +31,5 @@ UTIL_LIBS =
 SONAME_LDFLAG = -h
 SHLIB_LDFLAGS = -R $(SunOS_LIBDIR) -shared
 
-ifneq ($(debug),y)
-CFLAGS += -O2 -fno-omit-frame-pointer
-else
-# Less than -O1 produces bad code and large stack frames
-CFLAGS += -O1 -fno-omit-frame-pointer
-endif
-
 CFLAGS += -Wa,--divide -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__
 
index 571704d9ae5f68ce34cca1d59ebdb963e0a73c7f..2921f308208e714c1f712ea7e94e7b67b3f0bc59 100644 (file)
@@ -6,6 +6,8 @@ export XEN_OS=MiniOS
 
 export stubdom=y
 export debug=y
+# Moved from config/StdGNU.mk
+CFLAGS += -O1 -fno-omit-frame-pointer
 
 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
   ifeq ($(wildcard $(MINI_OS)/Config.mk),)
index 5a80fecce1a647916151aad8873b40c28634b55b..0e73690b004a92f5cdf8a06047d7f4bd9fd8ec43 100644 (file)
@@ -138,9 +138,11 @@ SHLIB_libxenvchan  = $(SHDEPS_libxenvchan) -Wl,-rpath-link=$(XEN_LIBVCHAN)
 
 ifeq ($(debug),y)
 # Disable optimizations and enable debugging information for macros
-CFLAGS += -O0 -g3
+CFLAGS += -O0 -g3 -fno-omit-frame-pointer
 # But allow an override to -O0 in case Python enforces -D_FORTIFY_SOURCE=<n>.
 PY_CFLAGS += $(PY_NOOPT_CFLAGS)
+else
+CFLAGS += -O2 -fomit-frame-pointer
 endif
 
 LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2)
index a9fda7146d62776adfdb336e55f60dcb6e70eaa4..08cc776ebcdd55b84b20d62bf1898d36f0298a18 100644 (file)
@@ -46,6 +46,12 @@ ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
 ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
 ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
 
+ifeq ($(CONFIG_DEBUG),y)
+CFLAGS += -O1
+else
+CFLAGS += -O2 -fomit-frame-pointer
+endif
+
 CFLAGS += -nostdinc -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
 CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h