Re: Linkers - making executables smaller

bill@amber.ssd.csd.harris.com (Bill Leonard)
19 Jun 1998 23:30:02 -0400

          From comp.compilers

Related articles
Linkers - making executables smaller peterh@pernod.demon.co.uk (1998-06-18)
Re: Linkers - making executables smaller leichter@smarts.com (Jerry Leichter) (1998-06-19)
Re: Linkers - making executables smaller alan@ezlink.com (1998-06-19)
Re: Linkers - making executables smaller bill@amber.ssd.csd.harris.com (1998-06-19)
Re: Linkers - making executables smaller corbett@lupa.Eng.Sun.COM (1998-06-24)
Re: Linkers - making executables smaller henry@spsystems.net (1998-06-24)
Re: Linkers - making executables smaller brdsutte@elis.rug.ac.be (1998-06-24)
| List of all articles for this month |

From: bill@amber.ssd.csd.harris.com (Bill Leonard)
Newsgroups: comp.compilers
Date: 19 Jun 1998 23:30:02 -0400
Organization: Concurrent Computer Corporation, Ft. Lauderdale FL
References: 98-06-103
Keywords: linker

peterh@pernod.demon.co.uk (Peter Hall) writes:
> Have you come across any technologies in which the
> linker performs 'global' optimisations?


Many modern compilers, especially for C++ and Ada, perform global
optimization and program analysis steps at the link stage. The
Concurrent compilers do this, for example.


Often these optimization/analysis steps are not really performed by
the linker itself, but rather by a "pre-linker". It still has access
to the same information, and logically one could consider it to be
part of the linker, but it is usually a separate program. This is
done primarily for simplicity (a program should perform one logical
function, not several) as well as to maintain compatibility with other
processors that may use the linker.


> I know that there are profiling tools but these seem to feed back into
> the compiler.


The Concurrent HAPSE Ada compiler does some removal of unused
subprograms just prior to linking. Except in rare instances, I don't
think it is a big win, but it does help to keep the executable size
down.


Most of the optimizations done at link time are generally aimed at
speed, not space. That's probably because speed is of more concern to
more users than space. If any language systems do space optimizations
at link time, it would probably be those that are particularly
targeted towards embedded systems that must meet stringent size
constraints.


Chances are, though, that the programmer can make a much bigger impact
on size by reorganizing the code than any link-time optimizer can do.
For instance, a pre-linker might be able to remove unused subprograms,
but so probably can the programmer with a little work, and in the
process might gain other advantages as well.


> Is this an unreasonable request? Is there any real reason why linkers
> are stuck in the early 1970s?


I would disagree with this conclusion. Linkers haven't actually
changed much in the last 20 years because, fundamentally, the tasks
they need to perform have not changed. A linker's primary task is to
resolve symbol references among separate object modules. If you want
to perform other tasks, they should be done in separate programs,
perhaps executed as part of the "linking stage" but physically
separate.
--
Bill Leonard
Concurrent Computer Corporation
2101 W. Cypress Creek Road
Fort Lauderdale, FL 33309
Bill.Leonard@mail.ccur.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.