[SCRIPT] Get potential __init functions from the kernel image

From: Matthias Hanisch (matze@camline.com)
Date: Wed Apr 18 2001 - 10:09:28 EST


Hi!

I got bored over Easter and wrote this little script to get all users of a
function using objdump on a vmlinux image.

"users" are functions that do ordinary calls to that function,
EXPORT_SYMBOL declarations, functions which get called by initcall and
setup functions.

Moreover a special character is prepended to each function - either if it
is a function in the .text.init segment or a normal .text function.

What is the benefit of this script?

I think there are a lot of benefits but I used it to get functions which
are not in the .text.init segment but should be moved to because the only
users of this function are initfuncs themselves.

To get a view of this invoke the script using

$ ./create_user_map <vmlinux image>

It creates a file user_map which contains the results. Additionally the
list of _potential_ __init functions in this image is displayed.

Why potential?

The primary reason is, that the information is taken from an image. Maybe
there are other callers of this function which are not compiled in. But
this can be verified easily using a find-xargs-grep combo on the kernel
source tree.

First results of this are already in the ac-tree, namely some aha1542_*
functions and rand_initialize().

I also sent another bunch of functions to Alan which are not included in
any tree yet, namely mcheck_init(), init_irq_proc(),
start_context_thread() and init_timervecs().

The other reason for _potential_ is, that there are function which use
exceptions and thus they cannot get into the .init section, namely
do_test_wp_bit().

I just wanted to provide this script to the community to encourage
everyone to run this on his latest image. Doing this, we can finally get
all functions which could be trown away after the initialization phase and
shrink the size of unswappable kernel memory.

Comments?

Have fun,

        Matze

P.S.: Maybe there are other interesting things to look at. E.g. all functions
      which are only exported using EXPORT_SYMBOL but only used in rare
      configurations. In this case, we could add a config option which
      disables this EXPORT_SYMBOL declarations and the linker would throw
      them away automatically.

-- 
Matthias Hanisch    mailto:matze@camline.com    phone: +49 8137 935-219


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



This archive was generated by hypermail 2b29 : Mon Apr 23 2001 - 21:00:26 EST