Re: kernel symbols

Keith Owens (kaos@ocs.com.au)
Tue, 09 Nov 1999 16:27:22 +1100


On Mon, 8 Nov 1999 22:17:37 -0600 (CST),
Victor Zandy <zandy@cs.wisc.edu> wrote:
> I would like a way to find the name, address, and length of every
>function currently loaded in the kernel (2.2.5 on x86). /proc/ksyms
>gives only exported symbols, so I've been looking at kernel executable
>with nm. For now, I'm not concerned about module functions.

Install ftp://ftp.ocs.com.au/pub/ksymoops/ksymoops-0.7c.tar.gz. Then

ksymoops -v /usr/src/linux/vmlinux -s /var/tmp/map < /dev/null

will build a complete system map containing every useful symbol from
vmlinux, from System.map and from loaded modules. No need to reinvent
the wheel.

> nm reports some symbols that do not appear to be loaded. They are
>generally at higher addresses and from the section labelled
>".text.init", although I have not checked them all individually. My
>guess is that these symbols were declared __initfunc, and as such
>their text was unloaded after they were executed. Is this right?
>
> If so, can I tell whether one of these symbols is loaded or not?

All symbols are loaded when the kernel is loaded. objdump --headers
/usr/src/vmlinux gives you the size and location of each section of
data or code.

> When/how are these symbols unloaded?

See arch/<architecture>/mm/init.c, function free_initmem. It frees all
pages from __init_begin to __init_end.

> Are only symbols in the .text.init section subject to being
> unloaded?

Read arch/<architecture>/vmlinux.lds and see what sections are included
between __init_begin and __init_end.

> Are there any documents on the net related to this?

Read the source, Luke :)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/