From patchwork Fri Apr 22 19:44:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 8915331 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9D614BF29F for ; Fri, 22 Apr 2016 19:44:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A54512021B for ; Fri, 22 Apr 2016 19:44:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7646B20221 for ; Fri, 22 Apr 2016 19:44:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751664AbcDVTow (ORCPT ); Fri, 22 Apr 2016 15:44:52 -0400 Received: from mail-qk0-f182.google.com ([209.85.220.182]:36515 "EHLO mail-qk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750902AbcDVTov (ORCPT ); Fri, 22 Apr 2016 15:44:51 -0400 Received: by mail-qk0-f182.google.com with SMTP id x7so42209107qkd.3 for ; Fri, 22 Apr 2016 12:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=I6BoTsEL+66/3vjdGgC/+4Mu35WWAoVzgFuUZBqoYPc=; b=BhVoZKFcjxQYCTQpunQJKbgrg+lHwZSfK42o6/NEWS5NpbLNauzeUmeTaRg1auTTWa x+n/ho77ITITe/4J9MlU8quHWb7uJ/9BO8wKgiHO/+HkedRiKhnL81avHtLwPQTzRNSL 5wHL9ctN9D41IMwl2KgAcb+wH92196UyLudgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=I6BoTsEL+66/3vjdGgC/+4Mu35WWAoVzgFuUZBqoYPc=; b=RNE/v3lRTvPqrGOTGnRQodOYj+n21PDdgbY/cF2+kcEIcspxSCsjUmjsbNZEE+9w6B owkTuC21JjJuFjZ4bvjUTDE/j04B9D/onDshc4k2KlzlKYq4dq2+FIJ6Iwz9i84cPW8i BV26pDRrEjyOqJmraEyyH7/DIWkphhwS0lQWfjpwBPmEhKMnbvrGRpxnVOVU3sUO1Rk/ 7hELHP6m1bVM1w7vKf1iZGtYzHx/plYxuUBXfEn9ZG62biIkU09tV3w41bWsWlYVEaVv /mbjheDj3C1+AArhPIkXyCDX2lITHMPwgxxLrivzGEjUiYQlNxACug4p4myAVjiQlS0o 3Cww== X-Gm-Message-State: AOPr4FXOYX+4eRPC8d5Qp65b+CnvqOOAzckrVGi/CBM4Gk2tHOo9vythv+wu9pDCh3ClprwW X-Received: by 10.55.203.131 with SMTP id u3mr26594874qkl.16.1461354290487; Fri, 22 Apr 2016 12:44:50 -0700 (PDT) Received: from xanadu.home ([2607:fa48:6e39:d410:feaa:14ff:fea7:ed77]) by smtp.gmail.com with ESMTPSA id o78sm2976565qge.23.2016.04.22.12.44.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Apr 2016 12:44:49 -0700 (PDT) Date: Fri, 22 Apr 2016 15:44:48 -0400 (EDT) From: Nicolas Pitre To: Randy Dunlap cc: Stephen Rothwell , linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild , Michal Marek Subject: Re: linux-next: Tree for Apr 22 (adjust_autoksyms.sh) In-Reply-To: Message-ID: References: <20160422153503.24aa389e@canb.auug.org.au> <571A56C4.7030907@infradead.org> <571A6BCE.9040904@infradead.org> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 22 Apr 2016, Nicolas Pitre wrote: > On Fri, 22 Apr 2016, Randy Dunlap wrote: > > > Yes, this patch helps, but I think there is still a problem. > > I think that trim needs to be done after CONFIG_BUILD_DOCSRC and possibly > > after CONFIG_SAMPLES are built. > > The later is already taken care of with commit dd92478a15. > > > At least CONFIG_BUILD_DOCSRC seems to > > cause this error: > > > > Setup is 16508 bytes (padded to 16896 bytes). > > System is 6125 kB > > CRC 8aa70f94 > > Kernel: arch/x86/boot/bzImage is ready (#9) > > ERROR: "cn_del_callback" [Documentation/connector/cn_test.ko] undefined! > > ERROR: "cn_add_callback" [Documentation/connector/cn_test.ko] undefined! > > ERROR: "cn_netlink_send" [Documentation/connector/cn_test.ko] undefined! > > ../scripts/Makefile.modpost:91: recipe for target '__modpost' failed > > make[2]: *** [__modpost] Error 1 > > This one is indeed a problem. Please try the following: ----- >8 Subject: [PATCH] kbuild: better abstract vmlinux sequential prerequisites When CONFIG_TRIM_UNUSED_KSYMS=y and CONFIG_BUILD_DOCSRC=y it is possible to get the following error: ERROR: "cn_del_callback" [Documentation/connector/cn_test.ko] undefined! ERROR: "cn_add_callback" [Documentation/connector/cn_test.ko] undefined! ERROR: "cn_netlink_send" [Documentation/connector/cn_test.ko] undefined! ../scripts/Makefile.modpost:91: recipe for target '__modpost' failed It is not sufficient to do "vmlinux-dirs += Documentation" as this also depends on the headers_check target, and all of this needs to be done before adjust_autoksyms.sh is executed. Let's sort this out by gathering those sequential prerequisites in a make target of their own, separate from the vmlinux target. And by doing so, the special autoksyms_recursive target is no longer needed. Signed-off-by: Nicolas Pitre Acked-by: Randy Dunlap Tested-by: Randy Dunlap --- 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/Makefile b/Makefile index e9ad498238..3f1eb6a1bf 100644 --- a/Makefile +++ b/Makefile @@ -926,17 +926,11 @@ export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Doc vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) -# Final link of vmlinux - cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -quiet_cmd_link-vmlinux = LINK $@ - -# Include targets which we want to -# execute if the rest of the kernel build went well. -vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE -ifdef CONFIG_TRIM_UNUSED_KSYMS - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ - "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile autoksyms_recursive" -endif +# Include targets which we want to execute sequentially if the rest of the +# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be +# evaluated more than once. +PHONY += vmlinux_prereq +vmlinux_prereq: $(vmlinux-deps) FORCE ifdef CONFIG_HEADERS_CHECK $(Q)$(MAKE) -f $(srctree)/Makefile headers_check endif @@ -946,17 +940,22 @@ endif ifdef CONFIG_GDB_SCRIPTS $(Q)ln -fsn `cd $(srctree) && /bin/pwd`/scripts/gdb/vmlinux-gdb.py endif - +$(call if_changed,link-vmlinux) - -autoksyms_recursive: $(vmlinux-deps) +ifdef CONFIG_TRIM_UNUSED_KSYMS $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ - "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile autoksyms_recursive" -PHONY += autoksyms_recursive + "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile vmlinux_prereq" +endif # standalone target for easier testing include/generated/autoksyms.h: FORCE $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true +# Final link of vmlinux + cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) +quiet_cmd_link-vmlinux = LINK $@ + +vmlinux: scripts/link-vmlinux.sh vmlinux_prereq FORCE + +$(call if_changed,link-vmlinux) + # Build samples along the rest of the kernel ifdef CONFIG_SAMPLES vmlinux-dirs += samples