From patchwork Wed Jul 6 17:57:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 9216807 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 761B060467 for ; Wed, 6 Jul 2016 17:57:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 699BA281B7 for ; Wed, 6 Jul 2016 17:57:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A948281D2; Wed, 6 Jul 2016 17:57:53 +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=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 E9D9F281B7 for ; Wed, 6 Jul 2016 17:57:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754786AbcGFR5o (ORCPT ); Wed, 6 Jul 2016 13:57:44 -0400 Received: from foss.arm.com ([217.140.101.70]:59555 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752945AbcGFR5n (ORCPT ); Wed, 6 Jul 2016 13:57:43 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 340EC28; Wed, 6 Jul 2016 10:58:42 -0700 (PDT) Received: from e104818-lin.cambridge.arm.com (e104818-lin.cambridge.arm.com [10.1.203.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3A2563F213; Wed, 6 Jul 2016 10:57:42 -0700 (PDT) Date: Wed, 6 Jul 2016 18:57:39 +0100 From: Catalin Marinas To: Kevin Brodsky Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Michal Marek , linux-kbuild@vger.kernel.org Subject: Re: [PATCH RESEND] arm64: fix vdso-offsets.h dependency Message-ID: <20160706175739.GB22615@e104818-lin.cambridge.arm.com> References: <1463071155-7435-1-git-send-email-kevin.brodsky@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1463071155-7435-1-git-send-email-kevin.brodsky@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) 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 Thu, May 12, 2016 at 05:39:15PM +0100, Kevin Brodsky wrote: > +# We need to generate vdso-offsets.h before compiling certain files in kernel/. > +# In order to do that, we should use the archprepare target, but we can't since > +# asm-offsets.h is included in some files used to generate vdso-offsets.h, and > +# asm-offsets.h is built in prepare0, for which archprepare is a dependency. > +# Therefore we need to generate the header after prepare0 has been made, hence > +# this hack. > +prepare: vdso_prepare > +vdso_prepare: prepare0 > + $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h This indeed looks dodgy. I'm not sure about the makefile rules but would the above override the "prepare" target in the top Makefile? I think a dependency problem we have is that arch/arm64/kernel/signal.o depends on include/generated/vdso-offsets.h. However, we don't have any target for the latter, only for $(objtree)arch/arm64/kernel/vdso/vdso-offsets.h which no-one is including. Because of this, we have a fake dependency in arch/arm64/kernel/Makefile. It's been a long time since I wrote makefiles but I think a simpler approach may be to just get the include/generated/vdso-offsets.h target and remove the arch/arm64/kernel/vdso/vdso-offsets.h one entirely like below. Otherwise, we give up on storing the generated file in include/generated/ and move arch/arm64/include/asm/vdso.h to arch/arm64/kernel/vdso/. -----------8<------------------------- --- 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 diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 7700c0c23962..9bdacbf59091 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -55,5 +55,4 @@ head-y := head.o extra-y += $(head-y) vmlinux.lds # vDSO - this must be built first to generate the symbol offsets -$(call objectify,$(arm64-obj-y)): $(obj)/vdso/vdso-offsets.h -$(obj)/vdso/vdso-offsets.h: $(obj)/vdso +$(objtree)/include/generated/vdso-offsets.h: $(obj)/vdso diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile index b467fd0a384b..44c20e3c9f43 100644 --- a/arch/arm64/kernel/vdso/Makefile +++ b/arch/arm64/kernel/vdso/Makefile @@ -23,7 +23,7 @@ GCOV_PROFILE := n ccflags-y += -Wl,-shared obj-y += vdso.o -extra-y += vdso.lds vdso-offsets.h +extra-y += vdso.lds ../../../../include/generated/vdso-offsets.h CPPFLAGS_vdso.lds += -P -C -U$(ARCH) # Force dependency (incbin is bad) @@ -42,11 +42,10 @@ $(obj)/%.so: $(obj)/%.so.dbg FORCE gen-vdsosym := $(srctree)/$(src)/gen_vdso_offsets.sh quiet_cmd_vdsosym = VDSOSYM $@ define cmd_vdsosym - $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ && \ - cp $@ include/generated/ + $(NM) $< | $(gen-vdsosym) | LC_ALL=C sort > $@ endef -$(obj)/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE +$(obj)/../../../../include/generated/vdso-offsets.h: $(obj)/vdso.so.dbg FORCE $(call if_changed,vdsosym) # Assembly rules for the .S files