Re: finding unused globals in the kernel

From: Arnd Bergmann
Date: Mon Mar 01 2004 - 04:52:28 EST


On Monday 01 March 2004 07:11, Keith Owens wrote:
> It is a bit harder than a simple compare.  EXPORT_SYMBOL(foo) generates
> a reference to foo even if nothing uses it, which hides unused
> variables.  Certain symbols appear as unused but are really used by the
> 2.4 version of insmod.  Your script does not handle modules at all.
>
> namespace.pl below handles all the special cases on kernels from 2.0
> through 2.4.  It needs updating for 2.6 kernels, enjoy.

Well, your script is about a related, but still different question.
namespace.pl apparently gives a list of symbols that could/should have
been marked static because they are not referenced outside of their
files. I have another script that does this as well, though yours
is a lot better at it.

The question that my checkunused.sh is trying to answer is which symbols
are never referenced at all and therefore could be removed from the
kernel binary. I intentionally kept the references from EXPORT_SYMBOL,
because I didn't want to think about whether there might be modules
using them.

Finding exported symbols that no module in the tree uses is yet
another problem. Your namespace.pl does this on object files, but
using cscope at source level could perhaps do this better.

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