[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <df1ce8c514c3efc1323d5ed69e6ecbdb2542b960.1695679700.git.falcon@tinylab.org>
Date: Tue, 26 Sep 2023 06:38:56 +0800
From: Zhangjin Wu <falcon@...ylab.org>
To: linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
linux-riscv@...ts.infradead.org, Arnd Bergmann <arnd@...db.de>
Cc: falcon@...ylab.org, palmer@...osinc.com, paul.walmsley@...ive.com,
paulburton@...nel.org, paulmck@...nel.org,
tsbogend@...ha.franken.de, w@....eu,
Thomas Weißschuh <linux@...ssschuh.net>,
Tim Bird <tim.bird@...y.com>
Subject: [PATCH v1 3/7] DCE/DSE: Add a new scripts/Makefile.syscalls
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 <falcon@...ylab.org>
---
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
--
2.25.1
Powered by blists - more mailing lists