[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] Enable compiling with gcc tracing
Make minimal adjustments in order to enable the compilation of the xen source-code with gcc-6's -fsanitize-coverage=trace-pc option. Due to a bug in Xen's build-system the flag for the compiler has to be handed in via the command line, i.e. for compiling one would use: make CC=<path to gcc-6> This is an experimental patch as in a final version you would not want all files to be compiled with this option by default. Signed-off-by: Felix Schmoll <eggi.innovations@xxxxxxxxx> --- xen/Rules.mk | 9 ++++++++- xen/include/xen/hypercall.h | 1 + xen/include/xen/my_tracer.h | 6 ++++++ xen/my_tracer.c | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 xen/include/xen/my_tracer.h create mode 100644 xen/my_tracer.c diff --git a/xen/Rules.mk b/xen/Rules.mk index 77bcd44922..14de50d540 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -33,7 +33,9 @@ override TARGET_ARCH := $(shell echo $(XEN_TARGET_ARCH) | \ TARGET := $(BASEDIR)/xen + # Note that link order matters! +ALL_OBJS-y += $(BASEDIR)/my_tracer.o ALL_OBJS-y += $(BASEDIR)/common/built_in.o ALL_OBJS-y += $(BASEDIR)/drivers/built_in.o ALL_OBJS-y += $(BASEDIR)/xsm/built_in.o @@ -46,6 +48,7 @@ else CFLAGS += -O2 -fomit-frame-pointer endif +CFLAGS += -fsanitize-coverage=trace-pc CFLAGS += -nostdinc -fno-builtin -fno-common CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h @@ -171,7 +174,11 @@ _clean_%/: FORCE $(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean %.o: %.c Makefile - $(CC) $(CFLAGS) -c $< -o $@ + if [ $@ != $(BASEDIR)/my_tracer.o ]; \ + then $(CC) $(CFLAGS) -c $< -o $@; \ + else \ + $(CC) -include $(BASEDIR)/include/xen/my_tracer.h -c $(BASEDIR)/my_tracer.c -o $(BASEDIR)/my_tracer.o; \ + fi %.o: %.S Makefile $(CC) $(AFLAGS) -c $< -o $@ diff --git a/xen/include/xen/hypercall.h b/xen/include/xen/hypercall.h index cc99aea57d..ec19e1c80f 100644 --- a/xen/include/xen/hypercall.h +++ b/xen/include/xen/hypercall.h @@ -5,6 +5,7 @@ #ifndef __XEN_HYPERCALL_H__ #define __XEN_HYPERCALL_H__ +#include <xen/my_tracer.h> #include <xen/types.h> #include <xen/time.h> #include <public/xen.h> diff --git a/xen/include/xen/my_tracer.h b/xen/include/xen/my_tracer.h new file mode 100644 index 0000000000..7081e60f34 --- /dev/null +++ b/xen/include/xen/my_tracer.h @@ -0,0 +1,6 @@ +#ifndef _TRACE_H_ +#define _TRACE_H_ + +void __sanitizer_cov_trace_pc(void); + +#endif diff --git a/xen/my_tracer.c b/xen/my_tracer.c new file mode 100644 index 0000000000..2a2f8053f8 --- /dev/null +++ b/xen/my_tracer.c @@ -0,0 +1 @@ +void __sanitizer_cov_trace_pc(void) { return; } -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |