From patchwork Mon Feb 7 15:15:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitri John Ledkov X-Patchwork-Id: 1589360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=n6tK6LF4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JsqTS0l2cz9s5B for ; Tue, 8 Feb 2022 02:15:40 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nH5jn-0003Eo-3J; Mon, 07 Feb 2022 15:15:31 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nH5jk-0003CI-Mp for kernel-team@lists.ubuntu.com; Mon, 07 Feb 2022 15:15:28 +0000 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 53ABD3F1CA for ; Mon, 7 Feb 2022 15:15:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1644246928; bh=Ti+5PmW3NN2vH7WYrMaCqHA4mEv8qkML/JvdeVI+2is=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n6tK6LF4YTA7bLiOwxhZErW4mSYbs1dbmKpfQyd4yHWAjAo3LoNN6xC4L3/In9Q2y uZZS471ScoaD9MPGJp/IhAxyaUvyzIvtvFUxPnz2FS2HyPLvY/2ddi/YiocEUJcgL4 40F2igTsNh4BLOo7l+NcVleRnNt5DorFw190Z8NUh8Adm98+tRAy9h5tOmG5UmXIRc gBHFw4TjD1FrqEboqHzXAw1Mfe8JppgSZYlAhQntfxFBgdTNVWIUCF9tHfOroFwpKI f/LJadGP5VmiQEQWbglhhYWDRONfMTPvDgKE18J1Ycty+4/okeYKQrRW3oRhJRYXx2 8wTaqXfcm4BXA== Received: by mail-ej1-f71.google.com with SMTP id ka12-20020a170907990c00b006c41c582397so2933883ejc.11 for ; Mon, 07 Feb 2022 07:15:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ti+5PmW3NN2vH7WYrMaCqHA4mEv8qkML/JvdeVI+2is=; b=zxeYPZ+lfmuYw6w8RvTial94PdFdRWAOUSY84Oy1QdETc8ERS53FY+HcfHAm72G/bq UNLDQ9ENhQlrA0ENfmyNfaEmojefGMbRIFJygyxEsHQZjQj9lxH8kLM5frgx4dgOHy/c dXB/xX6WRTYtug07u0e9/DKk17b4XRaOqiIdXure2h3AQhiiHZ2/9DwcHJH1kOK2sZRZ G9g7t+Fg/YZOeCP8RF7DInEqA3N4MN6i1t1NgHpPdLKR1cUJAkh+PqEPv8nVN+xh5M9Y kEfTxO54DRLeQmX5aYPCyI29gn6xF+Ij4Cu4n17AcOvuJJXKqjpOni0Tbl7kU5nuUETV QSJw== X-Gm-Message-State: AOAM530G5t7WfJR/IgzXjtirEc06oVscC/nfNpwamH9uSdqXjchhEf5s 4HeP1EhAji/cnjeHSfXMYp86/a46UFzFGyozpuWvoyUP0pntyNF/EpZV61n546nxKd5wCc8taey G/E0OtJ7Jjo8css12TDk23nfgfgy9ltvqTkkStG+rbA== X-Received: by 2002:a05:6402:4392:: with SMTP id o18mr2843318edc.338.1644246927774; Mon, 07 Feb 2022 07:15:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzoDvftsJHq3QWM/Q/lvCjtbBDCEQHuqaEyZuJ1j+qUJaJJSCcMXjLGl9jGqmlBwlrDpPuIHg== X-Received: by 2002:a05:6402:4392:: with SMTP id o18mr2843293edc.338.1644246927526; Mon, 07 Feb 2022 07:15:27 -0800 (PST) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id r22sm3786182ejo.48.2022.02.07.07.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 07:15:27 -0800 (PST) From: Dimitri John Ledkov To: kernel-team@lists.ubuntu.com Subject: [J][UNSTABLE][PATCH 3/7] kbuild: Add CONFIG_PAHOLE_VERSION Date: Mon, 7 Feb 2022 15:15:12 +0000 Message-Id: <20220207151516.211675-4-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220207151516.211675-1-dimitri.ledkov@canonical.com> References: <20220207151516.211675-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Nathan Chancellor There are a few different places where pahole's version is turned into a three digit form with the exact same command. Move this command into scripts/pahole-version.sh to reduce the amount of duplication across the tree. Create CONFIG_PAHOLE_VERSION so the version code can be used in Kconfig to enable and disable configuration options based on the pahole version, which is already done in a couple of places. Signed-off-by: Nathan Chancellor Signed-off-by: Daniel Borkmann Acked-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220201205624.652313-3-nathan@kernel.org (cherry picked from bpf-next commit 613fe169237785a4bb1d06397b52606b2967da53) Signed-off-by: Dimitri John Ledkov --- MAINTAINERS | 1 + init/Kconfig | 4 ++++ scripts/pahole-version.sh | 13 +++++++++++++ 3 files changed, 18 insertions(+) create mode 100755 scripts/pahole-version.sh diff --git a/MAINTAINERS b/MAINTAINERS index b694a8bd6e..ba0e2495c2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3418,6 +3418,7 @@ F: net/sched/cls_bpf.c F: samples/bpf/ F: scripts/bpf_doc.py F: scripts/pahole-flags.sh +F: scripts/pahole-version.sh F: tools/bpf/ F: tools/lib/bpf/ F: tools/testing/selftests/bpf/ diff --git a/init/Kconfig b/init/Kconfig index 602380550a..c6b8051c8d 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -86,6 +86,10 @@ config CC_HAS_ASM_INLINE config CC_HAS_NO_PROFILE_FN_ATTR def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror) +config PAHOLE_VERSION + int + default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE)) + config CONSTRUCTORS bool diff --git a/scripts/pahole-version.sh b/scripts/pahole-version.sh new file mode 100755 index 0000000000..f8a32ab93a --- /dev/null +++ b/scripts/pahole-version.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# +# Usage: $ ./pahole-version.sh pahole +# +# Prints pahole's version in a 3-digit form, such as 119 for v1.19. + +if [ ! -x "$(command -v "$@")" ]; then + echo 0 + exit 1 +fi + +"$@" --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/'