On 03/09/2025 5:12 pm, Jan Beulich wrote: > On 03.09.2025 17:26, Andrew Cooper wrote: >> On 03/09/2025 4:13 pm, Jan Beulich wrote: >>> 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 <[email protected]> >>> --- >>> 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 >> We do want to be taking a change like this, but it's also definitely not >> limited to out-of-tree builds. I have full paths embedded even for >> in-tree builds. > In xen-syms I see only two full paths - in debug info, supplying the base > path to the tree. That's okay to stay imo.
Not for reducible builds it's not. > > In xen.efi I see a few hundred, but they're all the same as above. As I > learned earlier today, SHF_MERGE processing isn't invoked when linking > ELF objects into a PE binary. > >> To be useful, it wants to apply to everything, not just the hypervisor, >> so does want to be in the top level Config.mk. > As per my first remark then. But no, I meanwhile realized that this can't > go in Config.mk: For the hypervisor we want to use $(srctree), i.e. > including the leaf /xen referencing the xen/ subtree. I expect that for > e.g. tools/libs/ we'd want something similar - eliminate the entire path > up to the base of the component's source dir. So it will need to be > piecemeal. Relative to the root of xen.git (or the source tarball) is the only sensible option. Anything else is intentionally misleading. In fact, Marek had a more-correct form of this patch in https://lore.kernel.org/xen-devel/0370c0eb1fd9ac00acab016792132fa0b943d384.1742317309.git-series.marma...@invisiblethingslab.com/T/#u which seems to be waiting on you to reply. Please, along with Marek and Anthony, figure out what a v2 should look like, which applies to the whole tree and does not trim the xen/ part of the path from the hypervisor. Oleksii, please track this for 4.21. Build reproducibility is not an optional exercise these days, and given multiple downstreams depending on it, it needs fixing for once and for all in upstream. ~Andrew
