From: Arnd Bergmann <arnd@arndb.de>
To: kernel-janitors@vger.kernel.org
Subject: Re: [Kernel-janitors] Re: finding unused globals in the kernel
Date: Mon, 01 Mar 2004 15:13:48 +0000 [thread overview]
Message-ID: <200403011613.48952.arnd@arndb.de> (raw)
In-Reply-To: <5138.1078121472@kao2.melbourne.sgi.com>
On Monday 01 March 2004 13:37, Keith Owens wrote:
> Your script depends on relocation data to see if a symbol is used or
> not, but reloc data is not reliable for this test. On architectures
> that use pc relative addressing, the compiler may not generate
> relocation entries for references within the same source file, because
> the compiler already knows the offset between the call and the target
> instruction so it can code the instruction directly instead of leaving
> it to the linker.
I have so far seen this only for static symbols and decided to just
skip all messages about static symbols in the output. As you noted,
the compiler already warns about them anyway. I have now checked with
other compiler versions and found that at least gcc-2.95 on s390
has some false positives because of this, though I did not see any
false positives with gcc-3.3 on x86_64 (could be coincidence).
> Even when reloc data is available, objdump does not
> always print it the way that you want, e.g. ia64 uses PCREL21B amongst
> others, not R_IA64_....
Right, there had to be bugs like that :(
> For the symbols that could be marked static, the act of changing them
> to static and rebuilding will do two things. Static symbols often let
> gcc generate better code. If a static symbol is not referenced at all,
> gcc will now tell you about it. It takes extra steps (mark static,
> rebuild, see warning message, remove dead symbol) but takes care of all
> cases and you end up with a cleaner code base when compared to doing a
> simple "any references" test.
Yes, I'm regularly doing exactly this for all the s390 specific code.
The problem is that if you do this for an allyesconfig kernel, you
need to change a lot of code that you don't own and have to do it
again every time you go looking for these problems.
In a perfect world, nobody would write global functions unless necessary
or at least use your script to check their own files. If you are simply
looking for dead code in one configuration is a lot easier when the
list is as short as possible.
Arnd <><
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2004-03-01 15:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-28 21:13 [Kernel-janitors] finding unused globals in the kernel Arnd Bergmann
2004-02-28 21:13 ` Arnd Bergmann
2004-03-01 6:11 ` [Kernel-janitors] " Keith Owens
2004-03-01 6:11 ` Keith Owens
2004-03-01 6:22 ` [Kernel-janitors] " Keith Owens
2004-03-01 6:22 ` Keith Owens
2004-03-01 9:42 ` [Kernel-janitors] " Arnd Bergmann
2004-03-01 9:42 ` Arnd Bergmann
2004-03-01 12:37 ` [Kernel-janitors] " Keith Owens
2004-03-01 12:37 ` Keith Owens
2004-03-01 14:32 ` [Kernel-janitors] " Marcelo Tosatti
2004-03-01 14:32 ` Marcelo Tosatti
2004-03-01 19:28 ` [Kernel-janitors] " Arnd Bergmann
2004-03-01 19:28 ` Arnd Bergmann
2004-03-01 15:13 ` Arnd Bergmann [this message]
2004-03-01 15:34 ` [Kernel-janitors] " Arnd Bergmann
2004-03-01 15:34 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200403011613.48952.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.