[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231101150404.754108-2-masahiroy@kernel.org>
Date: Thu, 2 Nov 2023 00:03:58 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Greg Ungerer <gerg@...nel.org>,
Jack Brennen <jbrennen@...gle.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>
Subject: [PATCH 1/7] modpost: move sym_name() to modpost.h
Move sym_name() to modpost.h so it can be used in other source files.
Also, add the 'const' qualifier to the function arguments.
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
---
scripts/mod/modpost.c | 8 --------
scripts/mod/modpost.h | 9 +++++++++
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 973b5e5ae2dd..896ecfa8483f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -710,14 +710,6 @@ static char *get_modinfo(struct elf_info *info, const char *tag)
return get_next_modinfo(info, tag, NULL);
}
-static const char *sym_name(struct elf_info *elf, Elf_Sym *sym)
-{
- if (sym)
- return elf->strtab + sym->st_name;
- else
- return "(unknown)";
-}
-
/*
* Check whether the 'string' argument matches one of the 'patterns',
* an array of shell wildcard patterns (glob).
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 1392afec118c..9834ac44846d 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -156,6 +156,15 @@ static inline unsigned int get_secindex(const struct elf_info *info,
return index;
}
+static inline const char *sym_name(const struct elf_info *elf,
+ const Elf_Sym *sym)
+{
+ if (sym)
+ return elf->strtab + sym->st_name;
+ else
+ return "(unknown)";
+}
+
/*
* If there's no name there, ignore it; likewise, ignore it if it's
* one of the magic symbols emitted used by current tools.
--
2.40.1
Powered by blists - more mailing lists