amd64 kernel modules: mapping sections to addresses
jhb at freebsd.org
Mon Jun 21 15:43:52 UTC 2010
On Monday 21 June 2010 10:39:08 am Andriy Gapon wrote:
> I've noticed that on amd64 addresses (sh_addr) of all sections in a kernel
> are zeros.
> This is unlike kernel itself and i386 modules.
> Kernel linker maps SHT_PROGBITS and SHT_NOBITS sections sequentially
starting at a
> certain base address and taking into account their sizes and alignment
> On the other hand, kgdb calculates section address as module base address
> sh_addr of the section. Which puts all sections, e.g. .text, .data, .bss,
> same address. This is correct only for .text which is normally the first
> described in a header.
> DTrace situation is even worse, because don't even take into account module
> address, not speaking of section relative addresses.
> Perhaps we should put some sh_addr values into amd64 kernel modules that
> match calculations done in link_elf_load_file.
> Or should we replicate logic from link_elf_load_file in all places that need
> map loaded module's sections to load addresses?
> What do you think?
> As I understand CTF data includes a symbol table.
> What kind of symbol addresses is used there? Are they relative within a
> corresponding section? Or something else?
np@ has a patch to gdb to fix this for kgdb. I haven't committed it as it
patched gdb internals and wasn't in a kgdb-specific place, but I'm not sure of
a better way to fix kgdb.
More information about the freebsd-hackers