[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Xen EFI build system and gcov



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@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.