Date: Mon, 21 Jun 2010 17:39:08 +0300 From: Andriy Gapon <avg@freebsd.org> To: freebsd-hackers@freebsd.org, freebsd-amd64@freebsd.org Subject: amd64 kernel modules: mapping sections to addresses Message-ID: <4C1F798C.7010204@freebsd.org>
next in thread | raw e-mail | index | archive | help
I've noticed that on amd64 addresses (sh_addr) of all sections in a kernel module 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 requirements. On the other hand, kgdb calculates section address as module base address plus sh_addr of the section. Which puts all sections, e.g. .text, .data, .bss, at the same address. This is correct only for .text which is normally the first section described in a header. DTrace situation is even worse, because don't even take into account module base address, not speaking of section relative addresses. Perhaps we should put some sh_addr values into amd64 kernel modules that would match calculations done in link_elf_load_file. Or should we replicate logic from link_elf_load_file in all places that need to map loaded module's sections to load addresses? What do you think? Thanks! P.S. 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? -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C1F798C.7010204>