LKML Archive on
help / color / mirror / Atom feed
From: James Hogan <>
To: Matt Redfearn <>
Cc: Palmer Dabbelt <>,
	Antony Pavlov <>,
	Ralf Baechle <>,,,
	Masahiro Yamada <>,
	Michal Marek <>,
Subject: Re: [PATCH v6 3/4] MIPS: vmlinuz: Use generic ashldi3
Date: Wed, 18 Apr 2018 00:09:21 +0100	[thread overview]
Message-ID: <20180417230921.GA29046@saruman> (raw)
In-Reply-To: <>

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

On Wed, Apr 11, 2018 at 08:50:18AM +0100, Matt Redfearn wrote:
> diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
> index adce180f3ee4..e03f522c33ac 100644
> --- a/arch/mips/boot/compressed/Makefile
> +++ b/arch/mips/boot/compressed/Makefile
> @@ -46,9 +46,12 @@ $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
>  vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o
> -extra-y += ashldi3.c bswapsi.c
> -$(obj)/ashldi3.o $(obj)/bswapsi.o: KBUILD_CFLAGS += -I$(srctree)/arch/mips/lib
> -$(obj)/ashldi3.c $(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c
> +extra-y += ashldi3.c
> +$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c
> +	$(call cmd,shipped)
> +
> +extra-y += bswapsi.c
> +$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c
>  	$(call cmd,shipped)


arch/mips/boot/compressed/ashldi3.c:4:10: fatal error: libgcc.h: No such file or directory
 #include "libgcc.h"

It looks like it had already copied ashldi3.c from arch/mips/lib/ when
building an older commit, and it hasn't been regenerated from lib/ since
the Makefile changed, so its still using the old version.

I think it should be using FORCE and if_changed like this:

diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index e03f522c33ac..abe77add8789 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -47,12 +47,12 @@ $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c
 vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o $(obj)/bswapsi.o
 extra-y += ashldi3.c
-$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c
-	$(call cmd,shipped)
+$(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
+	$(call if_changed,shipped)
 extra-y += bswapsi.c
-$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c
-	$(call cmd,shipped)
+$(obj)/bswapsi.c: $(obj)/%.c: $(srctree)/arch/mips/lib/%.c FORCE
+	$(call if_changed,shipped)
 targets := $(notdir $(vmlinuzobjs-y))
That resolves the build failures when checking out old -> new without
cleaning, since the .ashldi3.c.cmd is missing so it gets rebuilt.

It should also resolve issues if the path it copies from is updated in
future since the .ashldi3.c.cmd will get updated.

If you checkout new -> old without cleaning, the now removed
arch/mips/lib/ashldi3.c will get added which will trigger regeneration,
so it won't error.

However if you do new -> old -> new then the .ashldi3.cmd file isn't
updated while at old, so you get the same error as above. I'm not sure
there's much we can practically do about that, aside perhaps avoiding
the issue in future by somehow auto-deleting stale .*.cmd files.

Cc'ing kbuild folk in case they have any bright ideas.

At least the straightforward old->new upgrade will work with the above
fixup though. If you're okay with it I'm happy to apply as a fixup.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-04-17 23:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-11  7:50 [PATCH v6 1/4] Add notrace to lib/ucmpdi2.c Matt Redfearn
2018-04-11  7:50 ` [PATCH v6 2/4] lib: Rename compiler intrinsic selects to GENERIC_LIB_* Matt Redfearn
2018-04-11  7:50 ` [PATCH v6 3/4] MIPS: vmlinuz: Use generic ashldi3 Matt Redfearn
2018-04-17 23:09   ` James Hogan [this message]
2018-04-18  1:52     ` Masahiro Yamada
2018-04-18  8:39     ` Matt Redfearn
2018-04-11  7:50 ` [PATCH v6 4/4] MIPS: use generic GCC library routines from lib/ Matt Redfearn

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:

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

  git send-email \
    --in-reply-to=20180417230921.GA29046@saruman \ \ \ \ \ \ \ \ \ \ \
    --subject='Re: [PATCH v6 3/4] MIPS: vmlinuz: Use generic ashldi3' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).