From patchwork Tue Apr 17 23:09:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 10347037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 082A16039A for ; Tue, 17 Apr 2018 23:09:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1233120700 for ; Tue, 17 Apr 2018 23:09:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 054D22236A; Tue, 17 Apr 2018 23:09:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,T_TVD_MIME_EPI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91EC920700 for ; Tue, 17 Apr 2018 23:09:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752118AbeDQXJ1 (ORCPT ); Tue, 17 Apr 2018 19:09:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:42274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751878AbeDQXJ1 (ORCPT ); Tue, 17 Apr 2018 19:09:27 -0400 Received: from saruman (jahogan.plus.com [212.159.75.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 14588217D4; Tue, 17 Apr 2018 23:09:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14588217D4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jhogan@kernel.org Date: Wed, 18 Apr 2018 00:09:21 +0100 From: James Hogan To: Matt Redfearn Cc: Palmer Dabbelt , Antony Pavlov , Ralf Baechle , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Masahiro Yamada , Michal Marek , linux-kbuild@vger.kernel.org Subject: Re: [PATCH v6 3/4] MIPS: vmlinuz: Use generic ashldi3 Message-ID: <20180417230921.GA29046@saruman> References: <1523433019-17419-1-git-send-email-matt.redfearn@mips.com> <1523433019-17419-3-git-send-email-matt.redfearn@mips.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1523433019-17419-3-git-send-email-matt.redfearn@mips.com> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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) ci20_defconfig: 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: 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. Cheers James 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))