1 // SPDX-License-Identifier: GPL-2.0
3 #include "symbol/kallsyms.h"
7 u8 kallsyms2elf_type(char type)
10 return (type == 't' || type == 'w') ? STT_FUNC : STT_OBJECT;
13 int kallsyms__parse(const char *filename, void *arg,
14 int (*process_symbol)(void *arg, const char *name,
15 char type, u64 start))
20 FILE *file = fopen(filename, "r");
33 line_len = getline(&line, &n, file);
34 if (line_len < 0 || !line)
37 line[--line_len] = '\0'; /* \n */
39 len = hex2u64(line, &start);
42 if (len + 2 >= line_len)
45 symbol_type = line[len];
47 symbol_name = line + len;
50 if (len >= KSYM_NAME_LEN) {
55 err = process_symbol(arg, symbol_name, symbol_type, start);