Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1889628pxb; Fri, 5 Mar 2021 02:05:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzy/8clKAImhXIQFHHA8OvaaL4QXTu9E3LIN0ocZ/a1a2+X2w0dzaVus9P8SCMFx3IwA48g X-Received: by 2002:a05:6402:3075:: with SMTP id bs21mr8478500edb.274.1614938749717; Fri, 05 Mar 2021 02:05:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614938749; cv=none; d=google.com; s=arc-20160816; b=ejKW9Jnb3HOUJPYRFf9Rab79UIOmoM1DSf5ijF6PY7pkgg9QJ+kG9mfwtU67jna8mN sa6QnQ/YaoY+ot5iJUu8OCzp+vJVbk26g/1zyTvq3IjJhqkRuw4dfwFeuLPHulwRhXWQ 61zltQYSjVpas69t71UWldS7UeWpohKiGDDGR8baNWZlSjFbGQFi+dVX+FL/PqA9f/JE RkRoQBQID9NbOWTBq8/7TrdU/rCBOEnN7BjnNuwA3yrNmRFsyJhrN1Rb+Rst54gJVGjQ izK1txTy+d4Gz4Bc7kOdxTLdSe2TVaXh0utqRdlnsPATDfl0RIi84x5bYNAX47QF2Lf8 mEHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=GRC2Y0yC42Y1EH5KbI50W2aWiq7kngTQEblGKY3SQmc=; b=qNVnIIa/T9BuC810STUmzxYH9p0QVZtQl+tO8hVm6leOIQszz0pgQdCc000uBPMWMt ux3Ag6l4nRiU8+YjHah5bUWq2DSfBU2FX2TofOvbCXdFEtL8ahE1bnX4IpGLwTq6/VhZ rPZIK0DbbtpWPhrjAcJXYFnNeqH2y4d7Z2uA0+NN1eEodSJuXX2+tWCX8rhF+MyVVbwR eVYrrcqguKVtH/e8Y5D907F4T12fizE0kqW1t5PIJxc+p+f5wFd/NyZ7BsWQ3LdyLL15 MuZlDBRuNHcbatavvO3NjSUQ7Aci91DhgQDv6QaD/dDFd6rfKQeN9nJxfJAalgiSlzdm QMJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=GothC0fB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si1138113ejn.577.2021.03.05.02.05.24; Fri, 05 Mar 2021 02:05:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=GothC0fB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229950AbhCEKCV (ORCPT + 99 others); Fri, 5 Mar 2021 05:02:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbhCEKCR (ORCPT ); Fri, 5 Mar 2021 05:02:17 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F3DFC061574 for ; Fri, 5 Mar 2021 02:02:17 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id w1so2250458ejf.11 for ; Fri, 05 Mar 2021 02:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GRC2Y0yC42Y1EH5KbI50W2aWiq7kngTQEblGKY3SQmc=; b=GothC0fBH2XEicdmeOy5BlwIbxBo48V//n3KuOEKMVDhURBrKEn/1pxUN4qEWEBxVL VmRm+QJaoXGlEkFUEPwSTCYSZXnp7oS4PM6WDINCcivyN8nXan+UzaUjbdRAl0xabMLs /mFbFxoTbyRzi/zmsBkORqS/pvZLvfLxdpmIs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GRC2Y0yC42Y1EH5KbI50W2aWiq7kngTQEblGKY3SQmc=; b=kEY0CXcg2b/ygyhThJDCBjvjxrZhcpjhojveSBq95rbciAocjVD7VA9UjE5bPfZz78 Ufw679woC9gQ1FDHsZwnwsAbHK62JH69M7YgQVEE9UjZMdo8W56Tfx2g7oQna5nzdC9I 9pH9naLhukMizqDh8FrEdOOURpLQZVJlnj8s4Jfsq162XqCECFV72eQgav6xjKOGvTPa ka3IrN6gixkp6EnK9/xyvlsxZ/o+k9oKaeJ4UZ64fD76jxWygP95PFLcxee7rI0cX/u8 YmsmHSLNkAVfxpeNRMXnotTjAbcBS8cWdheYVVnA+FVTJGETqmB8lxIZnBTNG3jtRG/N eRhg== X-Gm-Message-State: AOAM533vRVWmpLEPi6DW6UF8DWNkK6uXn9PNqGTOTfGx++BZGdkZ0JUL KmSpMgYwVhrsaS4nolF6FCIr/Q== X-Received: by 2002:a17:906:7150:: with SMTP id z16mr1512151ejj.103.1614938536001; Fri, 05 Mar 2021 02:02:16 -0800 (PST) Received: from prevas-ravi.prevas.se ([80.208.71.141]) by smtp.gmail.com with ESMTPSA id y2sm1223419ejf.30.2021.03.05.02.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 02:02:15 -0800 (PST) From: Rasmus Villemoes To: Masahiro Yamada , Michal Marek Cc: Rasmus Villemoes , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: apply fixdep logic to link-vmlinux.sh Date: Fri, 5 Mar 2021 11:02:12 +0100 Message-Id: <20210305100212.818562-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch adding CONFIG_VMLINUX_MAP revealed a small defect in the build system: link-vmlinux.sh takes decisions based on CONFIG_* options, but changing one of those does not always lead to vmlinux being linked again. For most of the CONFIG_* knobs referenced previously, this has probably been hidden by those knobs also affecting some object file, hence indirectly also vmlinux. But CONFIG_VMLINUX_MAP is only handled inside link-vmlinux.sh, and changing CONFIG_VMLINUX_MAP=n to CONFIG_VMLINUX_MAP=y does not cause the build system to re-link (and hence have vmlinux.map emitted). Since that map file is mostly a debugging aid, this is merely a nuisance which is easily worked around by just deleting vmlinux and building again. But one could imagine other (possibly future) CONFIG options that actually do affect the vmlinux binary but which are not captured through some object file dependency. To fix this, make link-vmlinux.sh emit a .vmlinux.d file in the same format as the dependency files generated by gcc, and apply the fixdep logic to that. I've tested that this correctly works with both in-tree and out-of-tree builds. Signed-off-by: Rasmus Villemoes --- Makefile | 2 +- scripts/link-vmlinux.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b18dbc634690..19d2f7fd088a 100644 --- a/Makefile +++ b/Makefile @@ -1192,7 +1192,7 @@ cmd_link-vmlinux = \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE - +$(call if_changed,link-vmlinux) + +$(call if_changed_dep,link-vmlinux) targets := vmlinux diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 855fd4e6f03e..7d4b7c6f01e8 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -312,6 +312,7 @@ cleanup() rm -f vmlinux rm -f vmlinux.map rm -f vmlinux.o + rm -f .vmlinux.d } on_exit() @@ -421,6 +422,7 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then fi vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o} +echo "vmlinux: $0" > .vmlinux.d # fill in BTF IDs if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then -- 2.29.2