I have a working backtrace function which relies on a kernel symbol table I load using grub modules. All of this works properly. My problem lies with generating accurate symbol tables.
Code: Select all
i586-elf-objdump.exe -tC install/kernel.elf | grep .text | sort | cut -c 1-9,25- > symbols
I currently use that command to generate a list of symbols which includes the start and size of each function in the kernel. The problem is that my assembly functions have no reported size.
These functions, for background, are written in GNU AS assembly.
Code: Select all
00101ffa 000005e memory::PageController::VirtToPhys(memory::PageDirectory*, unsigned long)
00102058 000000b memory::PageController::Invalidate(unsigned long*)
00102064 000008c tasks::ProcessController::createProcess(void*, unsigned long)
001020f0 0000000 loader
0010212c 0000000 exception0
00102133 0000000 exception1
A quick look at the kernel .symtab section shows that my assembly functions are listed as NOTYPE, rather than FUNC.
Code: Select all
138: 001020f0 0 NOTYPE GLOBAL DEFAULT 1 loader
Currently I have a workaround. I currently manually patch the symbols table with a script that replaces the 0 size value with a precalculated value
Code: Select all
sed 's/0000000 loader/0000036 loader/' <symbols > symbols.tmp
Has anybody worked out how to do this properly? More specifically has anybody figured out how to generate proper symbols for assembly functions?