Linkers and Loaders

Author: John R. Levine

ISBN: 1558604960

Buy this book at www.fatbrain.com

Linking Unkinked
by Andrew Binstock
 

Good programmers are competent with their tools. They know the basic features well, and they have some knowledge of lesser-used options. With this knowledge, they can develop competent code in satisfactory quantity. Great programmers, however, make a point of knowing their tools intimately. They know many features, including the obscure ones, they know how to wield the tools to handle unusual situations, and just as important, they can bend the tools to do what they need. As a result, they generate better code more quickly. For this reason, before the advent of today’s massive IDEs, advanced developers liked emacs, the fabled editing environment that sported scads of functions and its own macro programming language.

Today’s development managers, especially those who did not serve a term as lead programmer—may not appreciate the benefits of imparting the details of tools to the developers who use them. But those who know the value of this information might be tempted to share John R. Levine’s “Linkers & Loaders” with their team. The link step is without a doubt the least understood in the programming cycle. Magical stuff happens during this short step that transforms object code into an executable file. Exactly what is happening remains an enigma to most programmers, who, as a result, underuse the linker options available to them.

For programmers who want to know more, Levine’s book will be a start. It explains in considerable detail what happens during the link step. Levine begins by examining a linker listing and the object code generated by a program. The latter is then re-examined in the context of what it needs to execute properly. From there, Levine ties the specific linking actions to the formats of the object and executable files. Different executables require different linking steps, which themselves are often defined by the layout of the object files. As a result, Levine’s book spends a considerable amount of space explaining the object code and executable file formats. Undoubtedly, most readers will confine themselves to reading about the object files they use primarily.

At this point, readers have a solid basis from which to begin understanding the switches and options that their own linkers offer them. And this is where you would expect Levine to start explaining the options common to most linkers. But surprisingly, the book ends at this point. In fact, the end is abrupt. I expected something to take with me to my next project. I was expecting some explanation of abstruse linker switches for my environment—since Levine discusses Windows NT object files in detail (as well as Intel .obj files and SPARC binaries), it seems logical that linker switches that allow these files to be manipulated beneficially should also be discussed. This would have been most useful.

A more critical shortcoming is squeezing discussion of the Java linking model into fewer than four pages. Linking in a semicompiled environment such as Java has unique aspects that should be examined in detail. Yet the discussion of Java is so abbreviated as to provide virtually no information—a rather peculiar lapse for a book published in late 1999. Finally, an omission defies explanation: The book’s preface touts a linker project written in Perl that can be downloaded from the author’s Web site. In fact, it is nowhere on the site. An inquiry to the author resulted in our being informed that he has not had the time to attend to this yet—which does his readers a grave disservice.

This book could have been useful to managers and developers alike and provided a wealth of valuable information. But just at the point where it would have come into its own, the author walks away. As such, I would avoid this book if I were aiming to provide developers on my team with information about the linkage step that they could apply to their next project.

However, for readers whose interest in linkers is more a function of their own curiosity, Levine’s book serves as a good introduction to linkers and to object files. For this purpose only, I can recommend the book.

Reprinted with permission of SDTimes.  Originally appeared in Issue 20  December 15, 2000.


ADVERTISEMENTS

I hate asking for change. They always make a face. It's like asking them to donate a kidney.

- George Costanza

ADVERTISEMENT

Sponsors