All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] common: make sure symbols-dummy.o gets rebuilt when needed
@ 2018-11-23 11:36 Jan Beulich
  2018-11-23 11:55 ` Andrew Cooper
  2018-11-23 12:27 ` Wei Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2018-11-23 11:36 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall

The per-arch top level make files don't record any dependencies for the
file, so its mere existence is enough for make to consider it up-to-
date. As of ab3e5f5ff9 ("xsplice, symbols: Implement fast symbol names
-> virtual addresses lookup") the file, however, depends on the
FAST_SYMBOL_LOOKUP config option, which may change between incremental
re-builds.

Use the $(extra-y) machinery to get the file built without an extra
recursion step into common/, but instead right when the other things in
that directory get built. Some makefile adjustments are necessary to
actually make this machinery work beyond the restricted set of place it
was used in before. Note however that an important restriction remains:
$(extra-y) may not overlap $(obj-y) or $(obj-bin-y).

Take the opportunity and also make the gendep invocation cover both
$(obj-bin-y) and $(extra-y), even if this is not directly related here.
I should have included them right away in 8b6ef9c152 ("compat: enforce
distinguishable file names in symbol table").

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Drop remaining symbols-dummy.o dependencies as well. Drop phony
    intermediate "extra" target. Mention that extra-y machinery wasn't
    fully functional before.

--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -110,7 +110,7 @@ define gendep
         DEPS += $(dir $(1)).$(notdir $(1)).d
     endif
 endef
-$(foreach o,$(filter-out %/,$(obj-y)),$(eval $(call gendep,$(o))))
+$(foreach o,$(filter-out %/,$(obj-y) $(obj-bin-y) $(extra-y)),$(eval $(call gendep,$(o))))
 
 # Ensure each subdirectory has exactly one trailing slash.
 subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n) $(subdir-)))
@@ -158,22 +158,22 @@ endif
 # Always build obj-bin files as binary even if they come from C source. 
 $(obj-bin-y): CFLAGS := $(filter-out -flto,$(CFLAGS))
 
-built_in.o: $(obj-y)
+built_in.o: $(obj-y) $(extra-y)
 ifeq ($(obj-y),)
 	$(CC) $(CFLAGS) -c -x c /dev/null -o $@
 else
 ifeq ($(CONFIG_LTO),y)
-	$(LD_LTO) -r -o $@ $^
+	$(LD_LTO) -r -o $@ $(filter-out $(extra-y),$^)
 else
-	$(LD) $(LDFLAGS) -r -o $@ $^
+	$(LD) $(LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^)
 endif
 endif
 
-built_in_bin.o: $(obj-bin-y)
+built_in_bin.o: $(obj-bin-y) $(extra-y)
 ifeq ($(obj-bin-y),)
 	$(CC) $(AFLAGS) -c -x assembler /dev/null -o $@
 else
-	$(LD) $(LDFLAGS) -r -o $@ $^
+	$(LD) $(LDFLAGS) -r -o $@ $(filter-out $(extra-y),$^)
 endif
 
 # Force execution of pattern rules (for which PHONY cannot be directly used).
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -100,10 +100,7 @@ prelink.o: $(ALL_OBJS)
 	$(LD) $(LDFLAGS) -r -o $@ $^
 endif
 
-$(BASEDIR)/common/symbols-dummy.o:
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common symbols-dummy.o
-
-$(TARGET)-syms: prelink.o xen.lds $(BASEDIR)/common/symbols-dummy.o
+$(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -127,10 +127,7 @@ prelink-efi.o: $(ALL_OBJS) efi/boot.init
 	$(guard) $(LD) $(LDFLAGS) -r -o $@ $(filter-out %/efi/built_in.o,$^)
 endif
 
-$(BASEDIR)/common/symbols-dummy.o:
-	$(MAKE) -f $(BASEDIR)/Rules.mk -C $(BASEDIR)/common symbols-dummy.o
-
-$(TARGET)-syms: prelink.o xen.lds $(BASEDIR)/common/symbols-dummy.o
+$(TARGET)-syms: prelink.o xen.lds
 	$(LD) $(LDFLAGS) -T xen.lds -N prelink.o $(build_id_linker) \
 	    $(BASEDIR)/common/symbols-dummy.o -o $(@D)/.$(@F).0
 	$(NM) -pa --format=sysv $(@D)/.$(@F).0 \
@@ -191,7 +188,7 @@ note_file :=
 endif
 note_file_option ?= $(note_file)
 
-$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/common/symbols-dummy.o efi/mkreloc
+$(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o efi/mkreloc
 	$(foreach base, $(VIRT_BASE) $(ALT_BASE), \
 	          $(guard) $(LD) $(call EFI_LDFLAGS,$(base)) -T efi.lds -N $< efi/relocs-dummy.o \
 	                $(BASEDIR)/common/symbols-dummy.o $(note_file_option) -o $(@D)/.$(@F).$(base).0 &&) :
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -75,6 +75,8 @@ tmem-y := tmem.o tmem_xen.o tmem_control
 tmem-$(CONFIG_COMPAT) += compat/tmem_xen.o
 obj-$(CONFIG_TMEM) += $(tmem-y)
 
+extra-y := symbols-dummy.o
+
 subdir-$(CONFIG_COVERAGE) += coverage
 subdir-$(CONFIG_UBSAN) += ubsan
 




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2] common: make sure symbols-dummy.o gets rebuilt when needed
  2018-11-23 11:36 [PATCH v2] common: make sure symbols-dummy.o gets rebuilt when needed Jan Beulich
@ 2018-11-23 11:55 ` Andrew Cooper
  2018-11-23 12:27 ` Wei Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2018-11-23 11:55 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Tim Deegan, Ian Jackson, Julien Grall

On 23/11/2018 11:36, Jan Beulich wrote:
> The per-arch top level make files don't record any dependencies for the
> file, so its mere existence is enough for make to consider it up-to-
> date. As of ab3e5f5ff9 ("xsplice, symbols: Implement fast symbol names
> -> virtual addresses lookup") the file, however, depends on the
> FAST_SYMBOL_LOOKUP config option, which may change between incremental
> re-builds.
>
> Use the $(extra-y) machinery to get the file built without an extra
> recursion step into common/, but instead right when the other things in
> that directory get built. Some makefile adjustments are necessary to
> actually make this machinery work beyond the restricted set of place it
> was used in before. Note however that an important restriction remains:
> $(extra-y) may not overlap $(obj-y) or $(obj-bin-y).
>
> Take the opportunity and also make the gendep invocation cover both
> $(obj-bin-y) and $(extra-y), even if this is not directly related here.
> I should have included them right away in 8b6ef9c152 ("compat: enforce
> distinguishable file names in symbol table").
>
> Reported-by: Wei Liu <wei.liu2@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH v2] common: make sure symbols-dummy.o gets rebuilt when needed
  2018-11-23 11:36 [PATCH v2] common: make sure symbols-dummy.o gets rebuilt when needed Jan Beulich
  2018-11-23 11:55 ` Andrew Cooper
@ 2018-11-23 12:27 ` Wei Liu
  1 sibling, 0 replies; 3+ messages in thread
From: Wei Liu @ 2018-11-23 12:27 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Stefano Stabellini, Wei Liu, Konrad Rzeszutek Wilk,
	George Dunlap, Andrew Cooper, Ian Jackson, Tim Deegan,
	Julien Grall, xen-devel

On Fri, Nov 23, 2018 at 04:36:44AM -0700, Jan Beulich wrote:
> The per-arch top level make files don't record any dependencies for the
> file, so its mere existence is enough for make to consider it up-to-
> date. As of ab3e5f5ff9 ("xsplice, symbols: Implement fast symbol names
> -> virtual addresses lookup") the file, however, depends on the
> FAST_SYMBOL_LOOKUP config option, which may change between incremental
> re-builds.
> 
> Use the $(extra-y) machinery to get the file built without an extra
> recursion step into common/, but instead right when the other things in
> that directory get built. Some makefile adjustments are necessary to
> actually make this machinery work beyond the restricted set of place it
> was used in before. Note however that an important restriction remains:
> $(extra-y) may not overlap $(obj-y) or $(obj-bin-y).
> 
> Take the opportunity and also make the gendep invocation cover both
> $(obj-bin-y) and $(extra-y), even if this is not directly related here.
> I should have included them right away in 8b6ef9c152 ("compat: enforce
> distinguishable file names in symbol table").
> 
> Reported-by: Wei Liu <wei.liu2@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2018-11-23 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23 11:36 [PATCH v2] common: make sure symbols-dummy.o gets rebuilt when needed Jan Beulich
2018-11-23 11:55 ` Andrew Cooper
2018-11-23 12:27 ` Wei Liu

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.