Message ID | 1313175602-21834-1-git-send-email-sboyd@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > lib1funcs.S is reshipped even though the file hasn't changed > because the make rule is marked with FORCE. According to Sam > Ravnborg: > > The FORCE prerequisite will tell make to always execute > the command. > But we only want to execute the command if: > 1) $(obj)/lib1funcs.S is missing > 2) or $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S is not > older then $(obj)/lib1funcs.S > > So dropping FORCE should be a safe thing to do. > > This fixes the shipped problem, but we still have to reassemble > lib1funcs.S because it isn't part of $targets. Add > lib1funcs.{S,o} to $targets to avoid relinking the compressed > vmlinux if nothing changes. > > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> > Acked-by: Sam Ravnborg <sam@ravnborg.org> > --- > arch/arm/boot/compressed/Makefile | 8 +++----- > 1 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile > index 0c74a6f..937fd26 100644 > --- a/arch/arm/boot/compressed/Makefile > +++ b/arch/arm/boot/compressed/Makefile > @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma > > targets := vmlinux vmlinux.lds \ > piggy.$(suffix_y) piggy.$(suffix_y).o \ > - font.o font.c head.o misc.o $(OBJS) > + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) > > # Make sure files are removed during clean > extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S > @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X > LDFLAGS_vmlinux += -T > > # For __aeabi_uidivmod > -lib1funcs = $(obj)/lib1funcs.o > - > -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE > +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S > $(call cmd,shipped) > You should be able to avoid the extra copy altogether by doing something ala: $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S $(call cmd,as_o_S) note that I also remove the $(SRCARCH), as there is no other `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' - Arnaud > # We need to prevent any GOTOFF relocs being used with references > @@ -140,7 +138,7 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ > echo "$$bad_syms" >&2; rm -f $@; false ) > > $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ > - $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE > + $(addprefix $(obj)/, $(OBJS)) $(obj)/lib1funcs.o FORCE > $(call if_changed,ld) > @$(check_for_bad_syms) > > -- > Sent by an employee of the Qualcomm Innovation Center, Inc. > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >
On Fri, Aug 12, 2011 at 04:48:12PM -0400, Arnaud Lacombe wrote: > You should be able to avoid the extra copy altogether by doing something ala: > > $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S > $(call cmd,as_o_S) > > note that I also remove the $(SRCARCH), as there is no other > `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' We tried such things, but it results in kbuild arguing over building lib1funcs.S in arch/arm/lib and arch/arm/boot/compressed. You end up with it rebuilding the arch/arm/lib one, followed by a rebuild of the arch/arm/boot/compressed one. We've ended up with what we have because its about the only way to get kbuild to behave.
Hi, On Fri, Aug 12, 2011 at 4:55 PM, Russell King - ARM Linux <linux@arm.linux.org.uk> wrote: > On Fri, Aug 12, 2011 at 04:48:12PM -0400, Arnaud Lacombe wrote: >> You should be able to avoid the extra copy altogether by doing something ala: >> >> $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S >> $(call cmd,as_o_S) >> >> note that I also remove the $(SRCARCH), as there is no other >> `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' > > We tried such things, but it results in kbuild arguing over building > lib1funcs.S in arch/arm/lib and arch/arm/boot/compressed. You end up > with it rebuilding the arch/arm/lib one, followed by a rebuild of the > arch/arm/boot/compressed one. > hum... I tried this approach on a reduced testcase with an object in arch/x86/boot/ using a prerequisite in arch/x86/lib/ and it seemed to behave as I would expect. From what I can find online, this comes from http://lkml.org/lkml/2009/11/13/246. Albin's original is broken because it refers to object in the source tree. I suspect Martin's change to work only because he had a stale `arch/$(SRCARCH)/lib/lib1funcs.o' in his tree. Sebastian's change is broken because he was badly using $(obj), he should have used $(objtree). All case are otherwise broken because of cross-subdirectory object dependency do not work. The commit I think you refer to should be: commit 4486b86368d72bcac76439638b36667b1c6a1360 Author: Russell King <rmk@dyn-67.arm.linux.org.uk> Date: Sun Jun 3 18:54:42 2007 +0100 [ARM] riscpc: fix decompressor font file handling font_acorn_8x8.o was being built in drivers/video/console/ twice during a build _in the same location_ - once for the kernel proper, and once for the decompressor. The result is when you came to run an install target, the kernel was always rebuilt due to this file apparantly having been built with different compiler arguments. Solve this by making a local copy at build time in the decompressor's directory. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> I suspect this would have done the job: $(obj)/font.o: $(srctree)/drivers/video/console/font_acorn_8x8.c $(cmd,cc_o_c) rather than abusing `cmd_shipped'. font.o would not have been built twice in the _same_ location, but respectively in `drivers/video/console/font_acorn_8x8.o' and `arch/arm/boot/compressed/font.o' - Arnaud > We've ended up with what we have because its about the only way to get > kbuild to behave. >
> > I suspect this would have done the job: > > $(obj)/font.o: $(srctree)/drivers/video/console/font_acorn_8x8.c > $(cmd,cc_o_c)' I prefer using $(call,shipped) and let kbuild figure out how build an .o file from a .c file. In other words - avoiding use of the internal to Makefile.build variables in various places. Sam
Hi, On Fri, Aug 12, 2011 at 6:03 PM, Sam Ravnborg <sam@ravnborg.org> wrote: >> >> I suspect this would have done the job: >> >> $(obj)/font.o: $(srctree)/drivers/video/console/font_acorn_8x8.c >> $(cmd,cc_o_c)' > > I prefer using $(call,shipped) and let kbuild figure out how > build an .o file from a .c file. > > In other words - avoiding use of the internal to Makefile.build > variables in various places. > indeed, but I'd argue that 1) this would not be the first Makefile using these internal macros (alpha and ia64 are using such construct for aliasing) and 2) the `cmd_shipped' stuff is as internal than other functions :-) I wonder if we could not make kbuild provide an interface for such code-reuse... - Arnaud
Hi, On Fri, Aug 12, 2011 at 4:48 PM, Arnaud Lacombe <lacombar@gmail.com> wrote: > Hi, > > On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: >> lib1funcs.S is reshipped even though the file hasn't changed >> because the make rule is marked with FORCE. According to Sam >> Ravnborg: >> >> The FORCE prerequisite will tell make to always execute >> the command. >> But we only want to execute the command if: >> 1) $(obj)/lib1funcs.S is missing >> 2) or $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S is not >> older then $(obj)/lib1funcs.S >> >> So dropping FORCE should be a safe thing to do. >> >> This fixes the shipped problem, but we still have to reassemble >> lib1funcs.S because it isn't part of $targets. Add >> lib1funcs.{S,o} to $targets to avoid relinking the compressed >> vmlinux if nothing changes. >> >> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> >> Acked-by: Sam Ravnborg <sam@ravnborg.org> >> --- >> arch/arm/boot/compressed/Makefile | 8 +++----- >> 1 files changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile >> index 0c74a6f..937fd26 100644 >> --- a/arch/arm/boot/compressed/Makefile >> +++ b/arch/arm/boot/compressed/Makefile >> @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma >> >> targets := vmlinux vmlinux.lds \ >> piggy.$(suffix_y) piggy.$(suffix_y).o \ >> - font.o font.c head.o misc.o $(OBJS) >> + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) >> >> # Make sure files are removed during clean >> extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S >> @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X >> LDFLAGS_vmlinux += -T >> >> # For __aeabi_uidivmod >> -lib1funcs = $(obj)/lib1funcs.o >> - >> -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE >> +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S >> $(call cmd,shipped) >> > You should be able to avoid the extra copy altogether by doing something ala: > > $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S > $(call cmd,as_o_S) > > note that I also remove the $(SRCARCH), as there is no other > `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' > I withdraw this proposal and will hack around this to find a proper solution from within kbuild, and eventually come back on these uses :-) - Arnaud >> # We need to prevent any GOTOFF relocs being used with references >> @@ -140,7 +138,7 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ >> echo "$$bad_syms" >&2; rm -f $@; false ) >> >> $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ >> - $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE >> + $(addprefix $(obj)/, $(OBJS)) $(obj)/lib1funcs.o FORCE >> $(call if_changed,ld) >> @$(check_for_bad_syms) >> >> -- >> Sent by an employee of the Qualcomm Innovation Center, Inc. >> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> >
On Fri, Aug 12, 2011 at 06:17:25PM -0400, Arnaud Lacombe wrote: > Hi, > > On Fri, Aug 12, 2011 at 6:03 PM, Sam Ravnborg <sam@ravnborg.org> wrote: > >> > >> I suspect this would have done the job: > >> > >> $(obj)/font.o: $(srctree)/drivers/video/console/font_acorn_8x8.c > >> $(cmd,cc_o_c)' > > > > I prefer using $(call,shipped) and let kbuild figure out how > > build an .o file from a .c file. > > > > In other words - avoiding use of the internal to Makefile.build > > variables in various places. > > > indeed, but I'd argue that 1) this would not be the first Makefile > using these internal macros (alpha and ia64 are using such construct > for aliasing) and 2) the `cmd_shipped' stuff is as internal than other > functions :-) A quick grep in Documentation/kbuild will show that only the shipped variant is documented. We could implement a general copy command - this is needed in some places like this. Sam
On Fri, 12 Aug 2011, Arnaud Lacombe wrote: > On Fri, Aug 12, 2011 at 4:48 PM, Arnaud Lacombe <lacombar@gmail.com> wrote: > > On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > >> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile > >> index 0c74a6f..937fd26 100644 > >> --- a/arch/arm/boot/compressed/Makefile > >> +++ b/arch/arm/boot/compressed/Makefile > >> @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma > >> > >> targets := vmlinux vmlinux.lds \ > >> piggy.$(suffix_y) piggy.$(suffix_y).o \ > >> - font.o font.c head.o misc.o $(OBJS) > >> + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) > >> > >> # Make sure files are removed during clean > >> extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S > >> @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X > >> LDFLAGS_vmlinux += -T > >> > >> # For __aeabi_uidivmod > >> -lib1funcs = $(obj)/lib1funcs.o > >> - > >> -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE > >> +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S > >> $(call cmd,shipped) > >> > > You should be able to avoid the extra copy altogether by doing something ala: > > > > $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S > > $(call cmd,as_o_S) > > > > note that I also remove the $(SRCARCH), as there is no other > > `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' > > > I withdraw this proposal and will hack around this to find a proper > solution from within kbuild, and eventually come back on these uses > :-) Any progress on this? I have a patch doing multiple similar $(call cmd,shipped) at the moment and this is far from looking nice. Nicolas
Hi, On Wed, Aug 17, 2011 at 11:44 PM, Nicolas Pitre <nico@fluxnic.net> wrote: > On Fri, 12 Aug 2011, Arnaud Lacombe wrote: >> On Fri, Aug 12, 2011 at 4:48 PM, Arnaud Lacombe <lacombar@gmail.com> wrote: >> > On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: >> >> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile >> >> index 0c74a6f..937fd26 100644 >> >> --- a/arch/arm/boot/compressed/Makefile >> >> +++ b/arch/arm/boot/compressed/Makefile >> >> @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma >> >> >> >> targets := vmlinux vmlinux.lds \ >> >> piggy.$(suffix_y) piggy.$(suffix_y).o \ >> >> - font.o font.c head.o misc.o $(OBJS) >> >> + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) >> >> >> >> # Make sure files are removed during clean >> >> extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S >> >> @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X >> >> LDFLAGS_vmlinux += -T >> >> >> >> # For __aeabi_uidivmod >> >> -lib1funcs = $(obj)/lib1funcs.o >> >> - >> >> -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE >> >> +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S >> >> $(call cmd,shipped) >> >> >> > You should be able to avoid the extra copy altogether by doing something ala: >> > >> > $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S >> > $(call cmd,as_o_S) >> > >> > note that I also remove the $(SRCARCH), as there is no other >> > `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' >> > >> I withdraw this proposal and will hack around this to find a proper >> solution from within kbuild, and eventually come back on these uses >> :-) > > Any progress on this? > > I have a patch doing multiple similar $(call cmd,shipped) at the moment > and this is far from looking nice. > What is your use-case ? Is it re-use of code in a different subdirectory (use-case presented in this thread), or aliasing of the same source under different object name in the same directory (as used in the alpha tree) ? If it is the former, I potentially have a solution, but it is highlighting bad use of the kbuild infrastructure. I have not been able to yet measure the impact of the breakage, ie. either localized or tree-wide. I should be able to provide you with more info, hopefully, this evening. Thanks, - Arnaud
On Thu, Aug 18, 2011 at 02:03:43PM -0400, Arnaud Lacombe wrote: > Hi, > > On Wed, Aug 17, 2011 at 11:44 PM, Nicolas Pitre <nico@fluxnic.net> wrote: > > On Fri, 12 Aug 2011, Arnaud Lacombe wrote: > >> On Fri, Aug 12, 2011 at 4:48 PM, Arnaud Lacombe <lacombar@gmail.com> wrote: > >> > On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > >> >> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile > >> >> index 0c74a6f..937fd26 100644 > >> >> --- a/arch/arm/boot/compressed/Makefile > >> >> +++ b/arch/arm/boot/compressed/Makefile > >> >> @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma > >> >> > >> >> targets := vmlinux vmlinux.lds \ > >> >> piggy.$(suffix_y) piggy.$(suffix_y).o \ > >> >> - font.o font.c head.o misc.o $(OBJS) > >> >> + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) > >> >> > >> >> # Make sure files are removed during clean > >> >> extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S > >> >> @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X > >> >> LDFLAGS_vmlinux += -T > >> >> > >> >> # For __aeabi_uidivmod > >> >> -lib1funcs = $(obj)/lib1funcs.o > >> >> - > >> >> -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE > >> >> +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S > >> >> $(call cmd,shipped) > >> >> > >> > You should be able to avoid the extra copy altogether by doing something ala: > >> > > >> > $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S > >> > $(call cmd,as_o_S) > >> > > >> > note that I also remove the $(SRCARCH), as there is no other > >> > `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' > >> > > >> I withdraw this proposal and will hack around this to find a proper > >> solution from within kbuild, and eventually come back on these uses > >> :-) > > > > Any progress on this? > > > > I have a patch doing multiple similar $(call cmd,shipped) at the moment > > and this is far from looking nice. > > What is your use-case ? Is it re-use of code in a different > subdirectory (use-case presented in this thread), or aliasing of the > same source under different object name in the same directory (as used > in the alpha tree) ? It is to be able to reuse the same file source file in both the main kernel and the decompressor, sometimes rebuilding it with differing options from the main kernel build. As the two environments are entirely separate, it is not always appropriate to clone the previously built object file. Hence, we copy the source file and re-build it. The alternative is that we could keep two copies of the same source in two different locations, but that's just plain idiotic just to satisfy some silly kbuild restriction.
On 8/18/2011 12:31 PM, Russell King - ARM Linux wrote: > On Thu, Aug 18, 2011 at 02:03:43PM -0400, Arnaud Lacombe wrote: >> Hi, >> >> On Wed, Aug 17, 2011 at 11:44 PM, Nicolas Pitre<nico@fluxnic.net> wrote: >>> On Fri, 12 Aug 2011, Arnaud Lacombe wrote: >>>> On Fri, Aug 12, 2011 at 4:48 PM, Arnaud Lacombe<lacombar@gmail.com> wrote: >>>>> On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd<sboyd@codeaurora.org> wrote: >>>>>> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile >>>>>> index 0c74a6f..937fd26 100644 >>>>>> --- a/arch/arm/boot/compressed/Makefile >>>>>> +++ b/arch/arm/boot/compressed/Makefile >>>>>> @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma >>>>>> >>>>>> targets := vmlinux vmlinux.lds \ >>>>>> piggy.$(suffix_y) piggy.$(suffix_y).o \ >>>>>> - font.o font.c head.o misc.o $(OBJS) >>>>>> + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) >>>>>> >>>>>> # Make sure files are removed during clean >>>>>> extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S >>>>>> @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X >>>>>> LDFLAGS_vmlinux += -T >>>>>> >>>>>> # For __aeabi_uidivmod >>>>>> -lib1funcs = $(obj)/lib1funcs.o >>>>>> - >>>>>> -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE >>>>>> +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S >>>>>> $(call cmd,shipped) >>>>>> >>>>> You should be able to avoid the extra copy altogether by doing something ala: >>>>> >>>>> $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S >>>>> $(call cmd,as_o_S) >>>>> >>>>> note that I also remove the $(SRCARCH), as there is no other >>>>> `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' >>>>> >>>> I withdraw this proposal and will hack around this to find a proper >>>> solution from within kbuild, and eventually come back on these uses >>>> :-) >>> Any progress on this? >>> >>> I have a patch doing multiple similar $(call cmd,shipped) at the moment >>> and this is far from looking nice. >> What is your use-case ? Is it re-use of code in a different >> subdirectory (use-case presented in this thread), or aliasing of the >> same source under different object name in the same directory (as used >> in the alpha tree) ? > It is to be able to reuse the same file source file in both the main > kernel and the decompressor, sometimes rebuilding it with differing > options from the main kernel build. > > As the two environments are entirely separate, it is not always > appropriate to clone the previously built object file. > > Hence, we copy the source file and re-build it. > > The alternative is that we could keep two copies of the same source > in two different locations, but that's just plain idiotic just to > satisfy some silly kbuild restriction. > Can the second file just contain a "#include " of the 1st?
Hi, On Thu, Aug 18, 2011 at 6:25 PM, Troy Kisky <troy.kisky@boundarydevices.com> wrote: > On 8/18/2011 12:31 PM, Russell King - ARM Linux wrote: >> >> On Thu, Aug 18, 2011 at 02:03:43PM -0400, Arnaud Lacombe wrote: >>> >>> Hi, >>> >>> On Wed, Aug 17, 2011 at 11:44 PM, Nicolas Pitre<nico@fluxnic.net> wrote: >>>> >>>> On Fri, 12 Aug 2011, Arnaud Lacombe wrote: >>>>> >>>>> On Fri, Aug 12, 2011 at 4:48 PM, Arnaud Lacombe<lacombar@gmail.com> >>>>> wrote: >>>>>> >>>>>> On Fri, Aug 12, 2011 at 3:00 PM, Stephen Boyd<sboyd@codeaurora.org> >>>>>> wrote: >>>>>>> >>>>>>> diff --git a/arch/arm/boot/compressed/Makefile >>>>>>> b/arch/arm/boot/compressed/Makefile >>>>>>> index 0c74a6f..937fd26 100644 >>>>>>> --- a/arch/arm/boot/compressed/Makefile >>>>>>> +++ b/arch/arm/boot/compressed/Makefile >>>>>>> @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma >>>>>>> >>>>>>> targets := vmlinux vmlinux.lds \ >>>>>>> piggy.$(suffix_y) piggy.$(suffix_y).o \ >>>>>>> - font.o font.c head.o misc.o $(OBJS) >>>>>>> + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S >>>>>>> $(OBJS) >>>>>>> >>>>>>> # Make sure files are removed during clean >>>>>>> extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S >>>>>>> @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X >>>>>>> LDFLAGS_vmlinux += -T >>>>>>> >>>>>>> # For __aeabi_uidivmod >>>>>>> -lib1funcs = $(obj)/lib1funcs.o >>>>>>> - >>>>>>> -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE >>>>>>> +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S >>>>>>> $(call cmd,shipped) >>>>>>> >>>>>> You should be able to avoid the extra copy altogether by doing >>>>>> something ala: >>>>>> >>>>>> $(obj)/lib1funcs.o: $(srctree)/arch/arm/lib/lib1funcs.S >>>>>> $(call cmd,as_o_S) >>>>>> >>>>>> note that I also remove the $(SRCARCH), as there is no other >>>>>> `arch/*/lib/lib1funcs.S' than `arch/arm/lib/lib1funcs.S' >>>>>> >>>>> I withdraw this proposal and will hack around this to find a proper >>>>> solution from within kbuild, and eventually come back on these uses >>>>> :-) >>>> >>>> Any progress on this? >>>> >>>> I have a patch doing multiple similar $(call cmd,shipped) at the moment >>>> and this is far from looking nice. >>> >>> What is your use-case ? Is it re-use of code in a different >>> subdirectory (use-case presented in this thread), or aliasing of the >>> same source under different object name in the same directory (as used >>> in the alpha tree) ? >> >> It is to be able to reuse the same file source file in both the main >> kernel and the decompressor, sometimes rebuilding it with differing >> options from the main kernel build. >> >> As the two environments are entirely separate, it is not always >> appropriate to clone the previously built object file. >> >> Hence, we copy the source file and re-build it. >> >> The alternative is that we could keep two copies of the same source >> in two different locations, but that's just plain idiotic just to >> satisfy some silly kbuild restriction. >> > Can the second file just contain a "#include " of the 1st? > <personal opinion> Sorry, but it'd taste awfully disgusting, and broken. <personal opinion/> - Arnaud
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 0c74a6f..937fd26 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile @@ -91,7 +91,7 @@ suffix_$(CONFIG_KERNEL_LZMA) = lzma targets := vmlinux vmlinux.lds \ piggy.$(suffix_y) piggy.$(suffix_y).o \ - font.o font.c head.o misc.o $(OBJS) + font.o font.c head.o misc.o lib1funcs.o lib1funcs.S $(OBJS) # Make sure files are removed during clean extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S @@ -121,9 +121,7 @@ LDFLAGS_vmlinux += -X LDFLAGS_vmlinux += -T # For __aeabi_uidivmod -lib1funcs = $(obj)/lib1funcs.o - -$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE +$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S $(call cmd,shipped) # We need to prevent any GOTOFF relocs being used with references @@ -140,7 +138,7 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \ echo "$$bad_syms" >&2; rm -f $@; false ) $(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ - $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE + $(addprefix $(obj)/, $(OBJS)) $(obj)/lib1funcs.o FORCE $(call if_changed,ld) @$(check_for_bad_syms)