From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] adjustments to the .o -> .init.o build rule Date: Fri, 18 Mar 2011 15:24:28 +0000 Message-ID: <4D83873C0200007800037423@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartE3CF203C.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartE3CF203C.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline First, $(shell ...) getting executed before the containing command gets invoked doesn't have the intended effect when the inner command wants variables of the outer command expanded. This needs to be done by the shell executing the entire command. Second, pattern rules for intermediate files with their targets not mentioned explicitly result in them getting deleted. Since the .*.o.d files get generated on the first make run and included for the second, the second run sees them mentioned explicitly and re-builds them (and the final *.init.o files), which is particularly annoying if the second build is actually an install (as root) while normal builds get run as ordinary user: Some of the output files will suddenly be root owned, possibly causing permission issues on a later rebuild. Signed-off-by: Jan Beulich --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -157,13 +157,13 @@ _clean_%/: FORCE SPECIAL_DATA_SECTIONS :=3D rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \ $(foreach r,rel rel.ro,data.$(r) data.$(r).local) =20 -%.init.o: %.o Makefile +$(filter %.init.o,$(obj-y) $(obj-bin-y)): %.init.o: %.o Makefile $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p}' | while read idx = name sz rest; do \ case "$$name" in \ .text|.text.*|.data|.data.*|.bss) \ test $$sz !=3D 0 || continue; \ echo "Error: size of $<:$$name is 0x$$sz" >&2; \ - exit $(shell expr $$idx + 1);; \ + exit $$(expr $$idx + 1);; \ esac; \ done $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section = .$(s)=3D.init.$(s)) $< $@ --=__PartE3CF203C.0__= Content-Type: text/plain; name="init-inline-fix.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="init-inline-fix.patch" First, $(shell ...) getting executed before the containing command = gets=0Ainvoked doesn't have the intended effect when the inner command = wants=0Avariables of the outer command expanded. This needs to be done by = the=0Ashell executing the entire command.=0A=0ASecond, pattern rules for = intermediate files with their targets not=0Amentioned explicitly result in = them getting deleted. Since the .*.o.d=0Afiles get generated on the first = make run and included for the second,=0Athe second run sees them mentioned = explicitly and re-builds them (and=0Athe final *.init.o files), which is = particularly annoying if the second=0Abuild is actually an install (as = root) while normal builds get run as=0Aordinary user: Some of the output = files will suddenly be root owned,=0Apossibly causing permission issues on = a later rebuild.=0A=0ASigned-off-by: Jan Beulich =0A= =0A--- a/xen/Rules.mk=0A+++ b/xen/Rules.mk=0A@@ -157,13 +157,13 @@ = _clean_%/: FORCE=0A SPECIAL_DATA_SECTIONS :=3D rodata $(foreach n,1 2 4 = 8,rodata.str1.$(n)) \=0A $(foreach r,rel rel.ro,dat= a.$(r) data.$(r).local)=0A =0A-%.init.o: %.o Makefile=0A+$(filter = %.init.o,$(obj-y) $(obj-bin-y)): %.init.o: %.o Makefile=0A $(OBJDUMP) = -h $< | sed -n '/[0-9]/{s,00*,0,g;p}' | while read idx name sz rest; do = \=0A case "$$name" in \=0A .text|.text.*|.data|.data.*= |.bss) \=0A test $$sz !=3D 0 || continue; \=0A = echo "Error: size of $<:$$name is 0x$$sz" >&2; \=0A- = exit $(shell expr $$idx + 1);; \=0A+ exit $$(expr $$idx = + 1);; \=0A esac; \=0A done=0A $(OBJCOPY) = $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=3D.init.$(s)) = $< $@=0A --=__PartE3CF203C.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartE3CF203C.0__=--