From patchwork Mon Sep 25 22:38:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13398524 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C70BAE6FE31 for ; Mon, 25 Sep 2023 22:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbjIYWjT (ORCPT ); Mon, 25 Sep 2023 18:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229585AbjIYWjT (ORCPT ); Mon, 25 Sep 2023 18:39:19 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0EBB9C; Mon, 25 Sep 2023 15:39:11 -0700 (PDT) X-QQ-mid: bizesmtp62t1695681542tdrh3qq7 Received: from linux-lab-host.localdomain ( [116.30.124.152]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 26 Sep 2023 06:38:56 +0800 (CST) X-QQ-SSF: 01200000002000E0Y000B00A0000000 X-QQ-FEAT: SFhf6fKhx//PtbsvyVYEL/gCYQ5xMD8J6LwaCKhulpVEfmJppGRkMmjMj3Bxv 8wdytKPzLVFJlPA82FjC2Ti02tsIHXGhP+Tb7KY7NXZeQX14PHTRUwY1uNtWxj7nVvdw5N8 ypB+bBYPZTiHwLTOfPVZ2o3kvUQu/slgqaqTTvxwiXKKuRoubwr8vyOsZC+zpBmOn8ghMQm AG5bLu8EeQJF77jcZcCDh8tBPzUgxyBcq+ybkOO584JaaHxdkRqP9QMqdLVLQkwKUzkpjRx 8jfcH0gidHmiUdV76m98gNAlJ0swOV9yXGIUaa85PdpJ4c+AiLAPLqrLnY0hvGmFDffugib /YpU8n7ZB5APg72lHoVQhLN1V/LOaRguiP/XLXevf0Z/Nx5UZypKAyBjtff2CMVyBvswmd1 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 11640928319628299727 From: Zhangjin Wu To: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, Arnd Bergmann Cc: falcon@tinylab.org, palmer@rivosinc.com, paul.walmsley@sifive.com, paulburton@kernel.org, paulmck@kernel.org, tsbogend@alpha.franken.de, w@1wt.eu, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Tim Bird Subject: [PATCH v1 3/7] DCE/DSE: Add a new scripts/Makefile.syscalls Date: Tue, 26 Sep 2023 06:38:56 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org When CONFIG_TRIM_UNUSED_SYSCALLS is enabled, get used syscalls from CONFIG_USED_SYSCALLS. CONFIG_USED_SYSCALLS may be a list of used syscalls or a file to store such a list. If CONFIG_USED_SYSCALLS is configured as a list of the used syscalls, directly record them in a used_syscalls variable, if it is a file to store the list, record the file name to the used_syscalls_file variable and put its content to the used_syscalls variable. Signed-off-by: Zhangjin Wu --- scripts/Makefile.syscalls | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 scripts/Makefile.syscalls diff --git a/scripts/Makefile.syscalls b/scripts/Makefile.syscalls new file mode 100644 index 000000000000..5864d3a85996 --- /dev/null +++ b/scripts/Makefile.syscalls @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifndef SCRIPTS_MAKEFILE_SYSCALLS + SCRIPTS_MAKEFILE_SYSCALLS = 1 + + ifdef CONFIG_TRIM_UNUSED_SYSCALLS + ifneq ($(wildcard $(CONFIG_USED_SYSCALLS)),) + used_syscalls_file = $(CONFIG_USED_SYSCALLS) + ifeq ($(shell test -s $(used_syscalls_file); echo $$?),0) + used_syscalls != cat $(CONFIG_USED_SYSCALLS) + endif + else + ifeq ($(subst /,,$(CONFIG_USED_SYSCALLS)),$(CONFIG_USED_SYSCALLS)) + used_syscalls = $(CONFIG_USED_SYSCALLS) + else + $(error No such file: $(CONFIG_USED_SYSCALLS)) + endif + endif + + ifneq ($(used_syscalls),) + used_syscalls := $(subst $(space),|,$(strip $(used_syscalls))) + endif + + used_syscalls_deps = $(used_syscalls_file) $(objtree)/.config + + export used_syscalls used_syscalls_deps + endif # CONFIG_TRIM_UNUSED_SYSCALLS + +endif # SCRIPTS_MAKEFILE_SYSCALLS