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.
Unified · Split
| @@ -0,0 +1,15 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +#ifndef _LINUX_MODULE_SYMBOL_H | |
| 3 | +#define _LINUX_MODULE_SYMBOL_H | |
| 4 | + | |
| 5 | +/* This ignores the intensely annoying "mapping symbols" found in ELF files. */ | |
| 6 | +static inline int is_arm_mapping_symbol(const char *str) | |
| 7 | +{ | |
| 8 | + if (str[0] == '.' && str[1] == 'L') | |
| 9 | + return true; | |
| 10 | + return str[0] == '$' && | |
| 11 | + (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') | |
| 12 | + && (str[2] == '\0' || str[2] == '.'); | |
| 13 | +} | |
| 14 | + | |
| 15 | +#endif /* _LINUX_MODULE_SYMBOL_H */ | |
| @@ -6,6 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | #include <linux/module.h> |
| 9 | +#include <linux/module_symbol.h> | |
| 9 | 10 | #include <linux/kallsyms.h> |
| 10 | 11 | #include <linux/buildid.h> |
| 11 | 12 | #include <linux/bsearch.h> |
| @@ -243,19 +244,6 @@ void init_build_id(struct module *mod, const struct load_info *info) · 231 unmodified lines | ||
| 243 | 244 | } |
| 244 | 245 | #endif |
| 245 | 246 | |
| 246 | −/* | |
| 247 | − * This ignores the intensely annoying "mapping symbols" found | |
| 248 | − * in ARM ELF files: $a, $t and $d. | |
| 249 | − */ | |
| 250 | −static inline int is_arm_mapping_symbol(const char *str) | |
| 251 | −{ | |
| 252 | − if (str[0] == '.' && str[1] == 'L') | |
| 253 | − return true; | |
| 254 | − return str[0] == '$' && | |
| 255 | − (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') | |
| 256 | − && (str[2] == '\0' || str[2] == '.'); | |
| 257 | −} | |
| 258 | − | |
| 259 | 247 | static const char *kallsyms_symbol_name(struct mod_kallsyms *kallsyms, unsigned int symnum) |
| 260 | 248 | { |
| 261 | 249 | return kallsyms->strtab + kallsyms->symtab[symnum].st_name; |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #include <errno.h> |
| 23 | 23 | #include "modpost.h" |
| 24 | 24 | #include "../../include/linux/license.h" |
| 25 | +#include "../../include/linux/module_symbol.h" | |
| 25 | 26 | |
| 26 | 27 | /* Are we using CONFIG_MODVERSIONS? */ |
| 27 | 28 | static bool modversions; |
| @@ -1112,15 +1113,6 @@ static int secref_whitelist(const struct sectioncheck *mismatch, · 1084 unmodified lines | ||
| 1112 | 1113 | return 1; |
| 1113 | 1114 | } |
| 1114 | 1115 | |
| 1115 | −static inline int is_arm_mapping_symbol(const char *str) | |
| 1116 | −{ | |
| 1117 | − if (str[0] == '.' && str[1] == 'L') | |
| 1118 | − return true; | |
| 1119 | − return str[0] == '$' && | |
| 1120 | − (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') | |
| 1121 | − && (str[2] == '\0' || str[2] == '.'); | |
| 1122 | −} | |
| 1123 | − | |
| 1124 | 1116 | /* |
| 1125 | 1117 | * If there's no name there, ignore it; likewise, ignore it if it's |
| 1126 | 1118 | * one of the magic symbols emitted used by current ARM tools. |