For in-tree builds relative paths are used, whereas for out-of-tree builds in various situations absolute ones come into play. The extra paths can be long, wasting space and e.g. serial line bandwidth. They would also get in the way of location-independent reproducible builds. Leverage newer gcc's (and Clang's) ability to "remap" file names. For older gcc fall back to using the option affecting debug info only.
Signed-off-by: Jan Beulich <jbeul...@suse.com> --- Of course we may want to consider putting this in the top-level Config.mk, to also affect other sub-trees (presently mainly/only affecting debug info, for which even gcc5 already supports -fdebug-prefix-remap=). As to a Fixes: tag, I wasn't quite sure whether to "blame" the introduction of out-of-tree builds. --- a/xen/Makefile +++ b/xen/Makefile @@ -448,6 +448,8 @@ LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin endif ifdef building_out_of_srctree + CFLAGS += $(call cc-option,$(CC),-ffile-prefix-map=$(srctree)/=, \ + -fdebug-prefix-map=$(srctree)/=) CFLAGS += -I$(objtree)/include CFLAGS += -I$(objtree)/arch/$(SRCARCH)/include endif