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

[PATCH v2] lib{fdt,elf}: move lib{fdt,elf}-temp.o and their deps to $(targets)


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 22 Jan 2024 12:39:55 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NKpaq1f2ZKt5X7zi9tVRDBaw+aRO2JsQfZpUwyEgfbw=; b=HvC8TDauwwROw9LogFaJdmHItrpxZeRnIOHpxjkKE15QZ7VRgYe7yIqiMLs5cXGdGLRynt1bmINiNh4kiPAGmSqVUl+n++gFmB4rOPWLhhwOMgv+bFMZBmOo4fMT5nAOjYvmb1yPhWREjVfeAyk4Mz6k79F3Tii4FzSZlcPw59vtmaFAX9GMJJUaVTHlZ+jB4NPjLc2jniNt6wdawc814qvLkm1wcoJ/aMUnDedH7trRkX1MSi4w0zfc9uFjDW/jmG4W0P5EJfUmWvVez/K1jWMn6qVaSn550cQdv0una4+WYRZAzQtGx02mq0t8orWwbAblRAZyzv/qNfaPazDjlw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q7GDoZNYT689a5cwnMO0Px01amYMVqj6OkSqGyz7nPCtRHD60MZZhDVGgsf6XttLgW0pWepiHvn8AbaRJR7iO24zEHYxCG02uc4v32LTlSBf8W0//gCc1R5atC8e9Unr5tD69FobQ3KoHH6QIP4GzftYLMgOTkNrPSeLEFGuX2QDiS3uj7a5jY8VA4SisI14VzWRpw/l+tjZ6LKyPqkSvxHb+2DVFUSb1k9SzltH//WyQ0slT/zLZvq3eQJCRWcUHuhkLTWg9tWhd2W/4F+QN45wNdHYhCxb5aSrTBgKAqpdHpK3Obazo71qOjct6BHjUHyzIpQddCvYt1IVhXnDXA==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Mon, 22 Jan 2024 11:40:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

At the moment, trying to run xencov read/reset (calling SYSCTL_coverage_op
under the hood) results in a crash. This is due to a profiler trying to
access data in the .init.* sections (libfdt for Arm and libelf for x86)
that are stripped after boot. Normally, the build system compiles any
*.init.o file without COV_FLAGS. However, these two libraries are
handled differently as sections will be renamed to init after linking.

To override COV_FLAGS to empty for these libraries, lib{fdt,elf}.o were
added to nocov-y. This worked until e321576f4047 ("xen/build: start using
if_changed") that added lib{fdt,elf}-temp.o and their deps to extra-y.
This way, even though these objects appear as prerequisites of
lib{fdt,elf}.o and the settings should propagate to them, make can also
build them as a prerequisite of __build, in which case COV_FLAGS would
still have the unwanted flags. Fix it by switching to $(targets) instead.

Also, for libfdt, append libfdt.o to nocov-y only if CONFIG_OVERLAY_DTB
is not set. Otherwise, there is no section renaming and we should be able
to run the coverage.

Fixes: e321576f4047 ("xen/build: start using if_changed")
Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
Changes in v2:
 - was "coverage: filter out lib{fdt,elf}-temp.o"
 - switch to $(targets), update rationale
---
 xen/common/libelf/Makefile | 2 +-
 xen/common/libfdt/Makefile | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/common/libelf/Makefile b/xen/common/libelf/Makefile
index 8a4522e4e141..917d12b006f7 100644
--- a/xen/common/libelf/Makefile
+++ b/xen/common/libelf/Makefile
@@ -13,4 +13,4 @@ $(obj)/libelf.o: $(obj)/libelf-temp.o FORCE
 $(obj)/libelf-temp.o: $(addprefix $(obj)/,$(libelf-objs)) FORCE
        $(call if_changed,ld)
 
-extra-y += libelf-temp.o $(libelf-objs)
+targets += libelf-temp.o $(libelf-objs)
diff --git a/xen/common/libfdt/Makefile b/xen/common/libfdt/Makefile
index d50487aa6e32..6ce679f98f47 100644
--- a/xen/common/libfdt/Makefile
+++ b/xen/common/libfdt/Makefile
@@ -5,10 +5,10 @@ SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
 # For CONFIG_OVERLAY_DTB, libfdt functionalities will be needed during runtime.
 ifneq ($(CONFIG_OVERLAY_DTB),y)
 OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
+nocov-y += libfdt.o
 endif
 
 obj-y += libfdt.o
-nocov-y += libfdt.o
 
 CFLAGS-y += -I$(srctree)/include/xen/libfdt/
 
@@ -18,4 +18,4 @@ $(obj)/libfdt.o: $(obj)/libfdt-temp.o FORCE
 $(obj)/libfdt-temp.o: $(addprefix $(obj)/,$(LIBFDT_OBJS)) FORCE
        $(call if_changed,ld)
 
-extra-y += libfdt-temp.o $(LIBFDT_OBJS)
+targets += libfdt-temp.o $(LIBFDT_OBJS)
-- 
2.25.1




 


Rackspace

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