build: make FILE symbol paths consistent

The FILE symbols in out-of-tree builds may be either a relative path to
the object dir or an absolute path depending on how the build is
invoked. Fix the paths for C files so that they are consistent with
in-tree builds - the path is relative to the "xen" directory (e.g.
common/irq.c).

This fixes livepatch builds when the original Xen build was out-of-tree
since livepatch-build always does in-tree builds. Note that this doesn't
fix the behaviour for Clang < 6 which always embeds full paths.

Fixes: 7115fa562f ("build: adding out-of-tree support to the xen build")
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 5b9bb91abb
master date: 2023-02-15 16:13:49 +0100
This commit is contained in:
Ross Lagerwall authored and Jan Beulich committed 2023-03-03 07:58:12 +01:00
1 parent 74b76704fd
commit 46c104cce0
1 file changed
+2 -1
+2 -1
View File
@@ -228,8 +228,9 @@ quiet_cmd_cc_o_c = CC $@
ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
ifneq ($(CONFIG_CC_IS_CLANG)$(call clang-ifversion,-lt,600,y),yy)
rel-path = $(patsubst $(abs_srctree)/%,%,$(call realpath,$(1)))
cmd_objcopy_fix_sym = \
$(OBJCOPY) --redefine-sym $(<F)=$< $(dot-target).tmp $@ && rm -f $(dot-target).tmp
$(OBJCOPY) --redefine-sym $(<F)=$(call rel-path,$<) $(dot-target).tmp $@ && rm -f $(dot-target).tmp
else
cmd_objcopy_fix_sym = mv -f $(dot-target).tmp $@
endif
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.