smart linker

Doug Gwyn gwyn at smoke.brl.mil
Fri Feb 22 08:11:55 AEST 1991


In article <1991Feb21.102123.9868 at cs.umn.edu> swie at cs.umn.edu (S. T. Tan) writes:
>Is there a C compiler bundled with a "smart linker" for DOS?
>What I meant by a smart linker is the linker which will only link and include 
>those routines which are referenced in the main program, and all of the 
>remaining unused routines are ignored so that the size of the excutable file 
>can be reduced.

While I'm not aware of the characteristics of MS-DOS C offerings,
I feel I should point out that the selective linking must be done
on the basis of OBJECT MODULE, not FUNCTION.  (An object module
would be the linkable unit produced by compiling one "translation
unit" [in C standard parlance].)  Generally in the UNIX world
linkers do act that way and also do not include in the image any
object modules from libraries except when they are needed to
satisfy external references.  With a minor amount of assistance
from the compiler, it is even possible to exploit this behavior
to exclude floating-point support from printf() when there has
been no use of floating-point in the program being linked.



More information about the Comp.lang.c mailing list