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_mapping_symbol(const char *str, int is_riscv) 7 { 8 if (str[0] == '.' && str[1] == 'L') 9 return true; 10 if (str[0] == 'L' && str[1] == '0') 11 return true; 12 /* 13 * RISC-V defines various special symbols that start with "$". The 14 * mapping symbols, which exist to differentiate between incompatible 15 * instruction encodings when disassembling, show up all over the place 16 * and are generally not meant to be treated like other symbols. So 17 * just ignore any of the special symbols. 18 */ 19 if (is_riscv) 20 return str[0] == '$'; 21 22 return str[0] == '$' && 23 (str[1] == 'a' || str[1] == 'd' || str[1] == 't' || str[1] == 'x') 24 && (str[2] == '\0' || str[2] == '.'); 25 } 26 27 #endif /* _LINUX_MODULE_SYMBOL_H */ 28