xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] adjustments to the .o -> .init.o build rule
Date: Fri, 18 Mar 2011 15:24:28 +0000	[thread overview]
Message-ID: <4D83873C0200007800037423@vpn.id2.novell.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1595 bytes --]

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 <jbeulich@novell.com>

--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -157,13 +157,13 @@ _clean_%/: FORCE
 SPECIAL_DATA_SECTIONS := rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \
 			 $(foreach r,rel rel.ro,data.$(r) data.$(r).local)
 
-%.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 != 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)=.init.$(s)) $< $@




[-- Attachment #2: init-inline-fix.patch --]
[-- Type: text/plain, Size: 1589 bytes --]

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 <jbeulich@novell.com>

--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -157,13 +157,13 @@ _clean_%/: FORCE
 SPECIAL_DATA_SECTIONS := rodata $(foreach n,1 2 4 8,rodata.str1.$(n)) \
 			 $(foreach r,rel rel.ro,data.$(r) data.$(r).local)
 
-%.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 != 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)=.init.$(s)) $< $@

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2011-03-18 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-18 15:24 Jan Beulich [this message]
2011-03-18 16:31 ` [PATCH] adjustments to the .o -> .init.o build rule Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D83873C0200007800037423@vpn.id2.novell.com \
    --to=jbeulich@novell.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).