All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Strip build path directories in tools and hypervisor
@ 2025-09-04 11:41 Marek Marczykowski-Górecki
  2025-09-04 12:58 ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Marczykowski-Górecki @ 2025-09-04 11:41 UTC (permalink / raw)
  To: xen-devel
  Cc: Marek Marczykowski-Górecki, Anthony PERARD, Andrew Cooper,
	Michal Orzel, Jan Beulich, Julien Grall, Roger Pau Monné,
	Stefano Stabellini

Use -fdebug-prefix-map in preference to -ffile-prefix-map, as it's
available in earlier toolchain versions. But use it together with
-fmacro-prefix-map (if available) for hypervisor build, otherwise it
still contains some paths in out-of-tree builds.

The out of tree build requires -fdebug-prefix-map mapping for both source
dir and object dir - otherwise the latter is included (2 occurrences) in
xen-syms. Note the ./xen path for out of tree builds may not be strictly
correct choice, but it's consistent across the tree, and just require
starting debugger from the source, not object, directory.

Ensure to have a realpath for XEN_ROOT else it fails to substitute
properly paths in strings sections.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
v2:
- re-add chunk wrapping XEN_ROOT with realpath; simplify it with patsubst
  in hypervisor makefile
- fix cc-option-add usage
- extend commit message
- claim authorship of the patch, as no single line remained from the
  original version
- drop change in xen/arch/x86/Makefile
---
 tools/Makefile | 2 +-
 tools/Rules.mk | 2 ++
 xen/Makefile   | 6 +++++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 6ecf7c0da821..80ec82a15979 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,4 +1,4 @@
-XEN_ROOT = $(CURDIR)/..
+XEN_ROOT = $(realpath $(CURDIR)/..)
 
 export PKG_CONFIG_DIR = $(CURDIR)/pkg-config
 
diff --git a/tools/Rules.mk b/tools/Rules.mk
index 725c3c32e9a2..428fce094819 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -166,6 +166,8 @@ endif
 CFLAGS-$(CONFIG_X86_32) += $(call cc-option,$(CC),-mno-tls-direct-seg-refs)
 CFLAGS += $(CFLAGS-y)
 
+$(call cc-option-add,CFLAGS,CC,-fdebug-prefix-map=$(realpath $(XEN_ROOT))=.)
+
 CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
 
 INSTALL_PYTHON_PROG = \
diff --git a/xen/Makefile b/xen/Makefile
index 49da79e10fb4..015255971804 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -208,7 +208,7 @@ VPATH := $(srctree)
 
 export srctree objtree VPATH
 
-export XEN_ROOT := $(abs_srctree)/..
+export XEN_ROOT := $(patsubst %/xen,%,$(abs_srctree))
 
 # To make sure we do not include .config for any of the *config targets
 # catch them early, and hand them over to tools/kconfig/Makefile
@@ -412,6 +412,10 @@ ifneq ($(CONFIG_CC_IS_CLANG),y)
 CFLAGS += -Wa,--strip-local-absolute
 endif
 
+$(call cc-option-add,CFLAGS,CC,-fdebug-prefix-map=$(abs_objtree)=./xen)
+$(call cc-option-add,CFLAGS,CC,-fdebug-prefix-map=$(abs_srctree)=./xen)
+$(call cc-option-add,CFLAGS,CC,-fmacro-prefix-map=$(abs_srctree)=./xen)
+
 AFLAGS += -D__ASSEMBLY__
 
 $(call cc-option-add,AFLAGS,CC,-Wa$$(comma)--noexecstack)
-- 
2.49.0



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

end of thread, other threads:[~2025-09-05 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 11:41 [PATCH v2] Strip build path directories in tools and hypervisor Marek Marczykowski-Górecki
2025-09-04 12:58 ` Jan Beulich
2025-09-04 14:27   ` Marek Marczykowski-Górecki
2025-09-05  8:15     ` Jan Beulich
2025-09-05 10:55       ` Marek Marczykowski-Górecki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.