diff options
author | Richard Braun <rbraun@sceen.net> | 2018-06-26 22:12:18 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-06-26 22:12:18 +0200 |
commit | b2ff0c98f026fa7feda1b658979c7e2d04404ae6 (patch) | |
tree | 949a9d42b7308457b2df75e6d11d90759384c1dc /tools/gen_symtab.py | |
parent | a6541cd67767e6c12841e8d91304e2ef3fa26995 (diff) | |
parent | 186d6a966ea70997846a95dd8c34b2e3e7f74145 (diff) |
Merge branch 'symtab'
Diffstat (limited to 'tools/gen_symtab.py')
-rwxr-xr-x | tools/gen_symtab.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/gen_symtab.py b/tools/gen_symtab.py new file mode 100755 index 00000000..b691da12 --- /dev/null +++ b/tools/gen_symtab.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +''' +Embedded symbol table generator. +''' + +import sys + +symtab_size = 0 +symtab = [] + +for line in sys.stdin: + line = line.strip() + parts = line.split(' ') + del parts[2] + + if len(parts) != 3 or parts[2].startswith("__func__."): + continue + + symtab.append("{ 0x%s, 0x%s, \"%s\" }" % tuple(parts)) + symtab_size += 1 + +print("#include <kern/symbol.h>") +print("const struct symbol symbol_table[] __symbol_table = {") + +for elem in symtab: + print(" " + elem + ",",) + +print("};") +print("const size_t symbol_table_size = %d;" % symtab_size) +print("const struct symbol *symbol_table_ptr = symbol_table;") |