Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3872560rdg; Wed, 18 Oct 2023 08:20:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2j3nfpTXzeuGijbMu8dOViYvRnMSTDs8eLnpeasU48xS22VIlBCVKoZyKWdNENIElA0+V X-Received: by 2002:a05:6300:8005:b0:179:fbd6:95f0 with SMTP id an5-20020a056300800500b00179fbd695f0mr4909798pzc.36.1697642452751; Wed, 18 Oct 2023 08:20:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697642452; cv=none; d=google.com; s=arc-20160816; b=SVQQgjpicisNX4gmKhXdPcDSifdkPn/HTI2Kk4tFXCd8mkTqEJb2s9PrzTmsh6i2ir y87k/zT1GLJ7nJI1rwNJKMTXrgmMDc0BDeeb1aDef2pAPMEgEkFCegqZdJ8zZbb6n34E TkJ8+C/PMKAH/cNdVWt+b2EjxWCU2OF7uLk/S0ggctQCeYBBWQP+QV+5GHGZVpin55/D wdiGmCY4IMbGzGTeSrqFzy9lm7UXcCFWBEeY8Z9o3AmhQzYZOmWgirzPRIy3BJYvxH37 riEs/yHQgXFowY4IzFhMr5Ynf7qseXMovUGXlQj/COz3vTSV6CA8SqJ6llxEFTiHPX0o p7sg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5kZdTBGuRP0qDnOA7mYxbW355fu9Amod16b3ktNpHFM=; fh=nY9BXmM6OvqPxK+j1qrAlSrJerCssKDI8ELrZ5Y0WGQ=; b=b1BEpAC2+u+r6UAsrQwhzyuef9CiQNuKsuYgiW/QKtJN+oqnbktHg8JSHWxhzes4AO 9fqMC84WAyB86HNxFgE/t3r+aOjcwyJx9rAH3Er/lRsmmOfr+sE4e+Q6AFsS4dcx4aoX ek/8lNnaM9mj088ITKw1+0ckKICLMTE4R5Pw0uxmTkttnV9pLUjdVcgUDuugJPu4Xn+V gYV214O1ci59axTQabz/Nn03tR/kRyQuqAd17ThB7fnraz6+6mPbtk4LRz0ZZChoCG4A BzzHOZFV6A4EXNl2lL4FumUziN30yQXSo9Tnvx7lcTo07IRPjkuCGdZmwQr3PmiH7VUG nmjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fTIyxfwr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l62-20020a633e41000000b00585a5e3039esi2332689pga.113.2023.10.18.08.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:20:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fTIyxfwr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C260C80D5861; Wed, 18 Oct 2023 08:20:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344771AbjJRPUW (ORCPT + 99 others); Wed, 18 Oct 2023 11:20:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231960AbjJRPUO (ORCPT ); Wed, 18 Oct 2023 11:20:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAFF8114; Wed, 18 Oct 2023 08:20:12 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED347C433CA; Wed, 18 Oct 2023 15:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697642412; bh=64NbOJwL+HDqWyuM6JoXFyBcAlHXP3zz+QUuLv6Cm7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTIyxfwrpTY5bgbva8rPbkcGlgqoZai0aO3PkJiKLsjwlaQN26q9Yhf7zRd2wjkRW WZduFe/lFbU/q+9u4epT/mVv1LqRuauO0bz5OWF23Kd8JMxngIYbgEwwc+f4kmivhh VJTyepbpLsgfF5FtZVGl8dMHPuvoQ8QD6No7cMYjk689j0+PdrMxAx2gcLvk6LY2TW Ety129FzUIr6FfwD15PVqI3wl9DSL9mvUBfMHnmNmKqGI6SnKNxfdm/eFbapyE1BFX gpiFW89j2Z6bS6GGInAnAKbVxMu33QTPYYdJA91bLmvH3+wqGmgTWgilv6JfdU0Nwc KdvBwAIq+VCYg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , bpf@vger.kernel.org Subject: [bpf-next PATCH v2 4/4] kbuild: refactor module BTF rule Date: Thu, 19 Oct 2023 00:19:50 +0900 Message-Id: <20231018151950.205265-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018151950.205265-1-masahiroy@kernel.org> References: <20231018151950.205265-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 08:20:35 -0700 (PDT) newer_prereqs_except and if_changed_except are ugly hacks of the newer-prereqs and if_changed in scripts/Kbuild.include. Remove. Signed-off-by: Masahiro Yamada --- Changes in v2: - Fix if_changed_except to if_changed scripts/Makefile.modfinal | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index 9fd7a26e4fe9..fc07854bb7b9 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -19,6 +19,9 @@ vmlinux := ifdef CONFIG_DEBUG_INFO_BTF_MODULES ifneq ($(wildcard vmlinux),) vmlinux := vmlinux +cmd_btf = ; \ + LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ + $(RESOLVE_BTFIDS) -b vmlinux $@ else $(warning Skipping BTF generation due to unavailability of vmlinux) endif @@ -41,27 +44,11 @@ quiet_cmd_ld_ko_o = LD [M] $@ cmd_ld_ko_o += \ $(LD) -r $(KBUILD_LDFLAGS) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ - -T scripts/module.lds -o $@ $(filter %.o, $^) + -T scripts/module.lds -o $@ $(filter %.o, $^) \ + $(cmd_btf) -quiet_cmd_btf_ko = BTF [M] $@ - cmd_btf_ko = \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ - $(RESOLVE_BTFIDS) -b vmlinux $@ - -# Same as newer-prereqs, but allows to exclude specified extra dependencies -newer_prereqs_except = $(filter-out $(PHONY) $(1),$?) - -# Same as if_changed, but allows to exclude specified extra dependencies -if_changed_except = $(if $(call newer_prereqs_except,$(2))$(cmd-check), \ - $(cmd); \ - printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) - -# Re-generate module BTFs if either module's .ko or vmlinux changed %.ko: %.o %.mod.o scripts/module.lds $(vmlinux) FORCE - +$(call if_changed_except,ld_ko_o,vmlinux) -ifdef vmlinux - +$(if $(newer-prereqs),$(call cmd,btf_ko)) -endif + +$(call if_changed,ld_ko_o) targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) -- 2.40.1