Message ID | ec58c0cd-2e39-15bd-a102-fd5b40e5e35d@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] build: fix dependency tracking for preprocessed files | expand |
On 05/06/2020 15:22, Jan Beulich wrote: > While the issue is more general, I noticed that asm-macros.i not getting > re-generated as needed. This was due to its .*.d file mentioning > asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at > it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds > dependency tracking files. While there, further avoid open-coding $(CPP) > and drop the bogus (Arm) / stale (x86) -Ui386. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Hi Jan, On 05/06/2020 15:22, Jan Beulich wrote: > While the issue is more general, I noticed that asm-macros.i not getting > re-generated as needed. This was due to its .*.d file mentioning > asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at > it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds > dependency tracking files. While there, further avoid open-coding $(CPP) > and drop the bogus (Arm) / stale (x86) -Ui386. Good catch! It looks like this was a verbatim copy of the x86 line as I can't see any reason why we would need it on Arm. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Julien Grall <jgrall@amazon.com> Cheers, > --- > v2: Move -MQ ahead on command lines. > > --- a/xen/Rules.mk > +++ b/xen/Rules.mk > @@ -201,13 +201,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) > $(call if_changed,obj_init_o) > > quiet_cmd_cpp_i_c = CPP $@ > -cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@ > +cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $< > > quiet_cmd_cc_s_c = CC $@ > cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@ > > quiet_cmd_s_S = CPP $@ > -cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ > +cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $< > > %.i: %.c FORCE > $(call if_changed,cpp_i_c) > --- a/xen/arch/arm/Makefile > +++ b/xen/arch/arm/Makefile > @@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-off > $(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $< > > xen.lds: xen.lds.S > - $(CC) -P -E -Ui386 $(a_flags) -o $@ $< > - sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new > - mv -f .xen.lds.d.new .xen.lds.d > + $(CPP) -P $(a_flags) -MQ $@ -o $@ $< > > dtb.o: $(CONFIG_DTB_FILE) > > --- a/xen/arch/x86/Makefile > +++ b/xen/arch/x86/Makefile > @@ -244,9 +244,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: > > efi.lds: AFLAGS-y += -DEFI > xen.lds efi.lds: xen.lds.S > - $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $< > - sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new > - mv -f .$(@F).d.new .$(@F).d > + $(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $< > > boot/mkelf32: boot/mkelf32.c > $(HOSTCC) $(HOSTCFLAGS) -o $@ $< >
> -----Original Message----- > From: Jan Beulich <jbeulich@suse.com> > Sent: 05 June 2020 15:23 > To: xen-devel@lists.xenproject.org > Cc: Andrew Cooper <andrew.cooper3@citrix.com>; George Dunlap <george.dunlap@citrix.com>; Ian Jackson > <ian.jackson@eu.citrix.com>; Julien Grall <julien@xen.org>; Stefano Stabellini > <sstabellini@kernel.org>; Wei Liu <wl@xen.org>; Paul Durrant <paul@xen.org> > Subject: [PATCH v2] build: fix dependency tracking for preprocessed files > > While the issue is more general, I noticed that asm-macros.i not getting > re-generated as needed. This was due to its .*.d file mentioning > asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at > it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds > dependency tracking files. While there, further avoid open-coding $(CPP) > and drop the bogus (Arm) / stale (x86) -Ui386. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > --- > v2: Move -MQ ahead on command lines. Looks like this is a fairly low risk fix to pull into 4.14 and it looks like it would be worth it... Release-acked-by: Paul Durrant <paul@xen.org> > > --- a/xen/Rules.mk > +++ b/xen/Rules.mk > @@ -201,13 +201,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) > $(call if_changed,obj_init_o) > > quiet_cmd_cpp_i_c = CPP $@ > -cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@ > +cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $< > > quiet_cmd_cc_s_c = CC $@ > cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@ > > quiet_cmd_s_S = CPP $@ > -cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ > +cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $< > > %.i: %.c FORCE > $(call if_changed,cpp_i_c) > --- a/xen/arch/arm/Makefile > +++ b/xen/arch/arm/Makefile > @@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-off > $(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $< > > xen.lds: xen.lds.S > - $(CC) -P -E -Ui386 $(a_flags) -o $@ $< > - sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new > - mv -f .xen.lds.d.new .xen.lds.d > + $(CPP) -P $(a_flags) -MQ $@ -o $@ $< > > dtb.o: $(CONFIG_DTB_FILE) > > --- a/xen/arch/x86/Makefile > +++ b/xen/arch/x86/Makefile > @@ -244,9 +244,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: > > efi.lds: AFLAGS-y += -DEFI > xen.lds efi.lds: xen.lds.S > - $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $< > - sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new > - mv -f .$(@F).d.new .$(@F).d > + $(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $< > > boot/mkelf32: boot/mkelf32.c > $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
--- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -201,13 +201,13 @@ $(filter %.init.o,$(obj-y) $(obj-bin-y) $(call if_changed,obj_init_o) quiet_cmd_cpp_i_c = CPP $@ -cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@ +cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) -MQ $@ -o $@ $< quiet_cmd_cc_s_c = CC $@ cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@ quiet_cmd_s_S = CPP $@ -cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@ +cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $< %.i: %.c FORCE $(call if_changed,cpp_i_c) --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -123,9 +123,7 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-off $(CC) $(filter-out -flto,$(c_flags)) -S -o $@ $< xen.lds: xen.lds.S - $(CC) -P -E -Ui386 $(a_flags) -o $@ $< - sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new - mv -f .xen.lds.d.new .xen.lds.d + $(CPP) -P $(a_flags) -MQ $@ -o $@ $< dtb.o: $(CONFIG_DTB_FILE) --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -244,9 +244,7 @@ $(BASEDIR)/include/asm-x86/asm-macros.h: efi.lds: AFLAGS-y += -DEFI xen.lds efi.lds: xen.lds.S - $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(a_flags)) -o $@ $< - sed -e 's/.*\.lds\.o:/$(@F):/g' <.$(@F).d >.$(@F).d.new - mv -f .$(@F).d.new .$(@F).d + $(CPP) -P $(filter-out -Wa$(comma)%,$(a_flags)) -MQ $@ -o $@ $< boot/mkelf32: boot/mkelf32.c $(HOSTCC) $(HOSTCFLAGS) -o $@ $<
While the issue is more general, I noticed that asm-macros.i not getting re-generated as needed. This was due to its .*.d file mentioning asm-macros.o instead of asm-macros.i. Use -MQ here as well, and while at it also use -MQ to avoid the somewhat fragile sed-ary on the *.lds dependency tracking files. While there, further avoid open-coding $(CPP) and drop the bogus (Arm) / stale (x86) -Ui386. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- v2: Move -MQ ahead on command lines.