optlink on multicore machines

Walter Bright newshound1 at digitalmars.com
Tue Jun 30 18:53:45 PDT 2009


Benji Smith wrote:
> Just out of curiosity... Why is a linker so hard to write?

Linkers are actually rather simple programs. The hard part is all the 
undocumented, semi-documented, and flat out wrong documentation on 
esoterica of the various file formats involved.

A linker that's been around for a while gets all this "lore" embedded 
into the code. Discarding it and not using it for a reference means 
you're in for years of debugging.

> (Caveat: I don't know much about Windows PE, or any of the many other 
> object file formats. Still, though... it doesn't seem like it could be 
> THAT difficult. The compiler has already done most of the tricky stuff.)

Here's a list of the file formats optlink deals with:

Intel OMF with Pharlap, Microsoft, and Digital Mars (!) extensions
Codeview (various versions of)
COM
EXE
New EXE
Portable EXE
16 bit Windows
16 bit DLLs
DOS Overlays
OS/2 executables
DOS extender executables
Stub executables
16 and 32 bit resource files
library file format
module definition file
map files
linker command files

For just one example, PE formats are only semi-documented. Write a file 
dumper for them and you'll see <g>.

Granted, these days one can cross about half of that off the list. But 
there's still a lot left.



More information about the Digitalmars-d mailing list