Commit 987d2e0a authored by Tiezhu Yang's avatar Tiezhu Yang Committed by Luis Chamberlain

module: Move is_arm_mapping_symbol() to module_symbol.h

In order to avoid duplicated code, move is_arm_mapping_symbol() to
include/linux/module_symbol.h, then remove is_arm_mapping_symbol()
in the other places.
Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
parent 87e5b1e8
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _LINUX_MODULE_SYMBOL_H
#define _LINUX_MODULE_SYMBOL_H
/* This ignores the intensely annoying "mapping symbols" found in ELF files. */
static inline int is_arm_mapping_symbol(const char *str)
{
if (str[0] == '.' && str[1] == 'L')
return true;
return str[0] == '$' &&
(str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x')
&& (str[2] == '\0' || str[2] == '.');
}
#endif /* _LINUX_MODULE_SYMBOL_H */
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/module_symbol.h>
#include <linux/kallsyms.h> #include <linux/kallsyms.h>
#include <linux/buildid.h> #include <linux/buildid.h>
#include <linux/bsearch.h> #include <linux/bsearch.h>
...@@ -243,19 +244,6 @@ void init_build_id(struct module *mod, const struct load_info *info) ...@@ -243,19 +244,6 @@ void init_build_id(struct module *mod, const struct load_info *info)
} }
#endif #endif
/*
* This ignores the intensely annoying "mapping symbols" found
* in ARM ELF files: $a, $t and $d.
*/
static inline int is_arm_mapping_symbol(const char *str)
{
if (str[0] == '.' && str[1] == 'L')
return true;
return str[0] == '$' &&
(str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x')
&& (str[2] == '\0' || str[2] == '.');
}
static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum) static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum)
{ {
return kallsyms->strtab + kallsyms->symtab[symnum].st_name; return kallsyms->strtab + kallsyms->symtab[symnum].st_name;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <errno.h> #include <errno.h>
#include "modpost.h" #include "modpost.h"
#include "../../include/linux/license.h" #include "../../include/linux/license.h"
#include "../../include/linux/module_symbol.h"
/* Are we using CONFIG_MODVERSIONS? */ /* Are we using CONFIG_MODVERSIONS? */
static bool modversions; static bool modversions;
...@@ -1112,15 +1113,6 @@ static int secref_whitelist(const struct sectioncheck *mismatch, ...@@ -1112,15 +1113,6 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
return 1; return 1;
} }
static inline int is_arm_mapping_symbol(const char *str)
{
if (str[0] == '.' && str[1] == 'L')
return true;
return str[0] == '$' &&
(str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x')
&& (str[2] == '\0' || str[2] == '.');
}
/* /*
* If there's no name there, ignore it; likewise, ignore it if it's * If there's no name there, ignore it; likewise, ignore it if it's
* one of the magic symbols emitted used by current ARM tools. * one of the magic symbols emitted used by current ARM tools.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment