From patchwork Fri Jun 24 22:42:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Hogan X-Patchwork-Id: 9198241 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 32DA06075F for ; Fri, 24 Jun 2016 22:43:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 220D120951 for ; Fri, 24 Jun 2016 22:43:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15366284E0; Fri, 24 Jun 2016 22:43:49 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 88B7620951 for ; Fri, 24 Jun 2016 22:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751229AbcFXWnU (ORCPT ); Fri, 24 Jun 2016 18:43:20 -0400 Received: from mailapp01.imgtec.com ([195.59.15.196]:9562 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751053AbcFXWmt (ORCPT ); Fri, 24 Jun 2016 18:42:49 -0400 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 29A228D048B63; Fri, 24 Jun 2016 23:42:42 +0100 (IST) Received: from jhogan-linux.le.imgtec.org (192.168.154.110) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Fri, 24 Jun 2016 23:42:46 +0100 From: James Hogan To: Thomas Gleixner CC: , James Hogan , Michal Marek , Arnd Bergmann , Ralf Baechle , Paul Burton , Florian Fainelli , , , Subject: [PATCH v4 2/2] kbuild: Remove stale asm-generic wrappers Date: Fri, 24 Jun 2016 23:42:24 +0100 Message-ID: <1466808144-23209-3-git-send-email-james.hogan@imgtec.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1466808144-23209-1-git-send-email-james.hogan@imgtec.com> References: <1466808144-23209-1-git-send-email-james.hogan@imgtec.com> MIME-Version: 1.0 X-Originating-IP: [192.168.154.110] 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 When a header file is removed from generic-y (often accompanied by the addition of an arch specific header), the generated wrapper file will persist, and in some cases may still take precedence over the new arch header. For example commit f1fe2d21f4e1 ("MIPS: Add definitions for extended context") removed ucontext.h from generic-y in arch/mips/include/asm/, and added an arch/mips/include/uapi/asm/ucontext.h. The continued use of the wrapper when reusing a dirty build tree resulted in build failures in arch/mips/kernel/signal.c: arch/mips/kernel/signal.c: In function ‘sc_to_extcontext’: arch/mips/kernel/signal.c:142:12: error: ‘struct ucontext’ has no member named ‘uc_extcontext’ return &uc->uc_extcontext; ^ Fix by detecting and removing wrapper headers in generated header directories that do not correspond to a filename in generic-y, genhdr-y, or the newly introduced generated-y. Reported-by: Jacek Anaszewski Reported-by: Hauke Mehrtens Reported-by: Heinrich Schuchardt Signed-off-by: James Hogan Acked-by: Arnd Bergmann Acked-by: Florian Fainelli Cc: Michal Marek Cc: Arnd Bergmann Cc: Ralf Baechle Cc: Paul Burton Cc: Florian Fainelli Cc: linux-kbuild@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-mips@linux-mips.org --- Changes in v4: - None (resend). Changes in v3: - Ensure FORCE actually gets marked .PHONY. Changes in v2: - Rewrite a bit, drawing inspiration from Makefile.headersinst. - Exclude genhdr-y and generated-y (thanks to kbuild test robot). --- scripts/Makefile.asm-generic | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.asm-generic b/scripts/Makefile.asm-generic index 045e0098e962..e4d017d53819 100644 --- a/scripts/Makefile.asm-generic +++ b/scripts/Makefile.asm-generic @@ -13,11 +13,26 @@ include scripts/Kbuild.include # Create output directory if not already present _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj)) +# Stale wrappers when the corresponding files are removed from generic-y +# need removing. +generated-y := $(generic-y) $(genhdr-y) $(generated-y) +all-files := $(patsubst %, $(obj)/%, $(generated-y)) +old-headers := $(wildcard $(obj)/*.h) +unwanted := $(filter-out $(all-files),$(old-headers)) + quiet_cmd_wrap = WRAP $@ cmd_wrap = echo "\#include " >$@ -all: $(patsubst %, $(obj)/%, $(generic-y)) +quiet_cmd_remove = REMOVE $(unwanted) +cmd_remove = rm -f $(unwanted) + +all: $(patsubst %, $(obj)/%, $(generic-y)) FORCE + $(if $(unwanted),$(call cmd,remove),) @: $(obj)/%.h: $(call cmd,wrap) + +PHONY += FORCE +.PHONY: $(PHONY) +FORCE: ;