[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] tools/Rules.mk: Don't optimize debug builds; add macro debugging information
On 12/01/2014 10:21 PM, Euan Harris wrote: > Tools debug builds are built with optimization level -O1, inherited from > the CFLAGS definition in StdGNU.mk. Optimizations confuse the debugger, > and the comment justifying -O1 in StdGNU.mk should not apply for a > userspace library. Disable optimization by appending -O0 to CFLAGS, > which overrides the -O1 flag specified earlier. > > Also specify -g3, to add macro debugging information which allows > gdb to expand macro invocations. This is useful as libxl uses many > non-trivial macros. > > Signed-off-by: Euan Harris <euan.harris@xxxxxxxxxx> > > Changes since v1: > * moved flag override to tools/Rules.mk so it affects all tools > --- > tools/Rules.mk | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/tools/Rules.mk b/tools/Rules.mk > index 87a56dc..7ef1ce5 100644 > --- a/tools/Rules.mk > +++ b/tools/Rules.mk > @@ -54,6 +54,11 @@ CFLAGS_libxenvchan = -I$(XEN_LIBVCHAN) > LDLIBS_libxenvchan = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) > -L$(XEN_LIBVCHAN) -lxenvchan > SHLIB_libxenvchan = -Wl,-rpath-link=$(XEN_LIBVCHAN) > > +ifeq ($(debug),y) > +# Disable optimizations and debugging information for macros > +CFLAGS += -O0 -g3 > +endif > + > LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2) > > ifeq ($(LIBXL_BLKTAP),y) > This patch causes a building error: gcc -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -Wno-unused-local-typedefs -O0 -g3 -D__XEN_TOOLS__ -MMD -MF .install.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -fPIC -I../../tools/include -I../../tools/libxc/include -Ixen/lowlevel/xc -I/usr/include/python2.7 -c xen/lowlevel/xc/xc.c -o build/temp.linux-x86_64-2.7/xen/lowlevel/xc/xc.o -fno-strict-aliasing -Werror In file included from /usr/include/limits.h:25:0, from /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/limits.h:168, from /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/syslimits.h:7, from /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/limits.h:34, from /usr/include/python2.7/Python.h:19, from xen/lowlevel/xc/xc.c:7: /usr/include/features.h:328:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp] # warning _FORTIFY_SOURCE requires compiling with optimization (-O) ^ cc1: all warnings being treated as errors error: command 'gcc' failed with exit status 1 The following patch can fix this problem: From d16961971e14f6e50f9a9905449929d5a7c60860 Mon Sep 17 00:00:00 2001 From: Wen Congyang <wency@xxxxxxxxxxxxxx> Date: Tue, 13 Jan 2015 12:05:30 +0800 Subject: [PATCH] Fix a building error Commit 1166ecf7 disables optimization. But _FORTIFY_SOURCE requires compiling with optimization (-O). Disable _FORTIFY_SOURCE by appending -Wp,-U_FORTIFY_SOURCE to CFLAGS. Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx> --- tools/Rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Rules.mk b/tools/Rules.mk index 962a743..8ad1b05 100644 --- 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 -Wp,-U_FORTIFY_SOURCE endif LIBXL_BLKTAP ?= $(CONFIG_BLKTAP2) -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |