Skip to contentSkip to conversation

Fix gcov build

PATCH In review Wei Liu 2 participants 7 messages Aug 31, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Fix gcov build

A small series to fix gcov build for both x86 and arm.

Wei Liu (4):
arm: acpi/boot.c is only used during initialisation
arm64: use "b" to branch to start_xen
xen: fix gcov compilation
xen: add a gcov Kconfig option

 Config.mk                  | 3 ---
 xen/Kconfig.debug          | 5 +++++
 xen/Rules.mk               | 4 +++-
 xen/arch/arm/acpi/Makefile | 2 +-
 xen/arch/arm/acpi/boot.c   | 2 +-
 xen/arch/arm/arm64/head.S  | 4 +++-
 xen/arch/x86/efi/Makefile  | 1 +
 xen/common/Makefile        | 2 +-
 8 files changed, 15 insertions(+), 8 deletions(-)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

PATCH v2 1/4 arm: acpi/boot.c is only used during initialisation

That file should contain code and data used during initialisation only.

Mark it as such in build system and correctly annotate enabled_cpus.

---
 xen/arch/arm/acpi/Makefile | 2 +-
 xen/arch/arm/acpi/boot.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/acpi/Makefile +1 -1
index 196c40a..23963f8 100644
@@ -1,2 +1,2 @@
 obj-y += lib.o
-obj-y += boot.o
+obj-y += boot.init.o
xen/arch/arm/acpi/boot.c +1 -1
index 28b3450..c3242a0 100644
@@ -37,7 +37,7 @@
 #include <asm/setup.h>
 
 /* Processors with enabled flag and sane MPIDR */
-static unsigned int enabled_cpus = 1;
+static unsigned int __initdata enabled_cpus = 1;
 static bool __initdata bootcpu_valid;
 
 /* total number of cpus in this system */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#2 lore raw

PATCH v2 2/4 arm64: use "b" to branch to start_xen

In reply to Wei Liu

The cbz instruction has range limitation. When compiled with gcov support the object is larger so cbz can't handle that anymore. The error message is like:

aarch64-linux-gnu-ld -EL -T xen.lds -N prelink.o \
/local/work/xen.git/xen/common/symbols-dummy.o -o /local/work/xen.git/xen/.xen-syms.0
prelink.o: In function `launch':
/local/work/xen.git/xen/arch/arm/arm64/head.S:602:(.text+0x408): relocation truncated to fit: R_AARCH64_CONDBR19 against symbol `start_xen' defined in .init.text section in prelink.o

Use "b" instead.

---
 xen/arch/arm/arm64/head.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
xen/arch/arm/arm64/head.S +3 -1
index 91e2817..3f63d2a 100644
@@ -599,7 +599,9 @@ launch:
         mov   x0, x20                /* Marshal args: - phys_offset */
         mov   x1, x21                /*               - FDT */
         mov   x2, x24                /*               - CPU ID */
-        cbz   x22, start_xen         /* and disappear into the land of C */
+        cbnz  x22, 1f
+        b     start_xen              /* and disappear into the land of C */
+1:
         b     start_secondary        /* (to the appropriate entry point) */
 
 /* Fail-stop */
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#3 lore raw

PATCH v2 3/4 xen: fix gcov compilation

In reply to Wei Liu

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. Because the dependency of stub.o in x86 EFI build can't be eliminated easily and we prefer a generalised method going forward, we introduce nogcov-y to explicitly mark objects that don't need to build with gcov support.

---
v2: Change "Due to" to "Because" and fix a typo in commit message.

Cc Andrew Cooper <[email protected]>
Cc George Dunlap <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Wei Liu <[email protected]>
---
 xen/Rules.mk              | 4 +++-
 xen/arch/x86/efi/Makefile | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
xen/Rules.mk +3 -1
index a190ff0..22aca0a 100644
@@ -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 $(nogcov-y),$(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
xen/arch/x86/efi/Makefile +1 -0
index 5099430..d62b14f 100644
@@ -12,3 +12,4 @@ efi := $(if $(efi),$(shell rm disabled)y,$(shell $(call create,boot.init.o); $(c
 extra-$(efi) += boot.init.o relocs-dummy.o runtime.o compat.o
 
 stub.o: $(extra-y)
+nogcov-$(efi) += stub.o
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v2 3/4
#4 lore raw

Re: [PATCH v2 3/4] xen: fix gcov compilation

Wei Liu writes ("[PATCH v2 3/4] xen: fix gcov compilation"):

Quoted 9 lines

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. Because the dependency of stub.o in x86 EFI build can't be eliminated easily and we prefer a generalised method going forward, we introduce nogcov-y to explicitly mark objects that don't need to build with gcov support.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#5 lore raw

PATCH v2 4/4 xen: add a gcov Kconfig option

In reply to Wei Liu
---
 Config.mk           | 3 ---
 xen/Kconfig.debug   | 5 +++++
 xen/Rules.mk        | 2 +-
 xen/common/Makefile | 2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)
Config.mk +0 -3
index 9c60896..081ff69 100644
@@ -20,9 +20,6 @@ or       = $(if $(strip $(1)),$(1),$(if $(strip $(2)),$(2),$(if $(strip $(3)),$(
 debug ?= y
 debug_symbols ?= $(debug)
 
-# Test coverage support
-coverage ?= n
-
 XEN_COMPILE_ARCH    ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
                          -e s/i86pc/x86_32/ -e s/amd64/x86_64/ \
                          -e s/armv7.*/arm32/ -e s/armv8.*/arm64/ \
xen/Kconfig.debug +5 -0
index 1be6344..06afd80 100644
@@ -28,6 +28,11 @@ config FRAME_POINTER
 	  maybe slower, but it gives very useful debugging information
 	  in case of any Xen bugs.
 
+config GCOV
+       bool "Gcov Support"
+       ---help---
+         Enable gcov (a test coverage program in GCC) support.
+
 config LOCK_PROFILE
 	bool "Lock Profiling"
 	---help---
xen/Rules.mk +1 -1
index 22aca0a..696aaa8 100644
@@ -115,7 +115,7 @@ subdir-all := $(subdir-y) $(subdir-n)
 
 $(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -DINIT_SECTIONS_ONLY
 
-ifeq ($(coverage),y)
+ifeq ($(CONFIG_GCOV),y)
 $(filter-out %.init.o $(nogcov-y),$(obj-y) $(obj-bin-y) $(extra-y)): CFLAGS += -fprofile-arcs -ftest-coverage -DTEST_COVERAGE
 endif
 
xen/common/Makefile +1 -1
index c2e6846..0fed30b 100644
@@ -75,7 +75,7 @@ obj-$(CONFIG_TMEM) += $(tmem-y)
 
 subdir-$(CONFIG_X86) += hvm
 
-subdir-$(coverage) += gcov
+subdir-$(CONFIG_GCOV) += gcov
 
 subdir-y += libelf
 subdir-$(CONFIG_HAS_DEVICE_TREE) += libfdt
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#6 lore raw
In reply to Wei Liu
Quoted 8 lines · Wei Liu

A small series to fix gcov build for both x86 and arm.

Wei Liu (4):
arm: acpi/boot.c is only used during initialisation
arm64: use "b" to branch to start_xen
xen: fix gcov compilation
xen: add a gcov Kconfig option

Series pushed.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel