|Link time optimizations email@example.com (1996-02-09)|
|Re: Link time optimizations firstname.lastname@example.org (1996-02-10)|
|Re: Link time optimizations email@example.com (1996-02-13)|
|Re: Link time optimizations firstname.lastname@example.org (1996-02-14)|
|From:||email@example.com (Jacob Navia)|
|Date:||9 Feb 1996 17:00:34 -0500|
Some months ago I developed an object file cross referencing utility
that would investigate all given files and produce a list of all
public names that were exported from a module but never used in any
I'm now finishing a linker (for Windows 95), and I will add that to
the linker. The algorithm that I used was simple: just look at all
symbol tables for symbols of type external and see whether they are
used elsewhere or not. The problem with this rather simplistic
approach is that a symbol could be used in the SAME module, i.e. it's
exported, used nowhere else, but used in that module.
Question is: how can my linker detect that?
For data references, the solution is easy: just see if there is a
relocation for that symbol. If there is, the symbol is used. For
functions (procedures) the problem is much more difficult. Normally
all compilers generate a jump PC relative instruction that generates
no relocation or fixup... Invisible damm it!
The only solution would be to disassemble all the .text section of the
module and see if there is a PC relative jump to that procedure but
this would lengthen considerably the link-time obviously...
Does anyone know of a solution (or a reference to a solution?) My
goal is to make an optimizing linker that would automatically delete
all unused code. Thanks in advance.
Jacob Navia Logiciels/Informatique
41 rue Maurice Ravel Tel (1) 18.104.22.168
93430 Villetaneuse Fax (1) 22.214.171.124
Return to the
Search the comp.compilers archives again.