xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Xen EFI build system and gcov
@ 2016-08-29 18:41 Wei Liu
  2016-08-30  8:38 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2016-08-29 18:41 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Xen-devel, Wei Liu

Hi Jan

Today I had some free cycles so I spent some time looking at gcov
support in the hypervisor and tried to write a patch to fix the
currently broken gcov build. But my patch alone is not enough to fix
that.

There seems to be a problem with the EFI Makefile. With my patch
applied, efi/boot.init.o still gets all gcov options _and_
-DINIT_SECTIONS_ONLY. See output and patch for more context.

If I force efi to be disabled by putting in a hack into efi/Makefile,
Xen builds fine. It suggests for all other files my patch works.

I am confused why efi/boot.init.o gets both set of options and I'm not
sure what is the best approach to fix it.

Do you have any suggestion on fixing that?

Thanks
Wei.

gcc ... -fprofile-arcs -ftest-coverage -DTEST_COVERAGE -DINIT_SECTIONS_ONLY -c boot.c -o boot.o
objdump -h boot.o | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name sz rest; do \
	case "$name" in \
	.*.local) ;; \
	.text|.text.*|.data|.data.*|.bss) \
		test $sz != 0 || continue; \
		echo "Error: size of boot.o:$name is 0x$sz" >&2; \
		exit $(expr $idx + 1);; \
	esac; \
done
Error: size of boot.o:.text is 0x012
/local/work/xen.git/xen/Rules.mk:184: recipe for target 'boot.init.o' failed

---8<---
From 36c9fe8274187c6f8a4caa6f6b9c354ca9db2866 Mon Sep 17 00:00:00 2001
From: Wei Liu <wei.liu2@citrix.com>
Date: Mon, 29 Aug 2016 19:11:59 +0100
Subject: [PATCH] xen: fix gcov compilation

Currently enabling gcov in hypervisor won't build because although
26c9d03d ("gcov: Adding support for coverage information") claimed that
%.init.o files were excluded from applying compilation options, it was
in fact not true.

Fix that by filtering out the options correctly.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
 xen/Rules.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index a190ff0..e49566c 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -115,7 +115,9 @@ subdir-all := $(subdir-y) $(subdir-n)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
-$(obj-$(coverage)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+ifeq ($(coverage),y)
+$(filter-out %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
+endif
 
 ifeq ($(lto),y)
 # Would like to handle all object files as bitcode, but objects made from
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-30  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-29 18:41 Xen EFI build system and gcov Wei Liu
2016-08-30  8:38 ` Jan Beulich
2016-08-30  8:56   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).