
Linkers and Loaders (1999) - ingve
https://www.iecc.com/linker/
======
spamvictim
Hi. I wrote "Linkers and Loaders."

I'm glad to see you all find it's useful but if so, please take a copy out of
the library or (perish forbid) buy a copy. You can find new and used copies in
the usual online stores.

The chapters on my web site are unedited review drafts with a lot of errors
that were fixed in the printed book.

~~~
speedplane
Maybe I started programming professionally too late, but the memory saving you
get from using a DLL never seemed worth the added complexity and and potential
incompatiblity problems that invariably pop up.

There are other decent uses for DLLs (plugins, Unix support like Cygwin), but
saving memory seems terribly insignificant.

~~~
palunon
This is a often huge difference between programming for Unix-likes and
Windows.

With Windows, you tend to bundle your application with all of its dependencies
in your installation folder...

With traditional Unix developpement you often rely on your dependencies being
installed on the target system by the package manager, and building against
shared librairies is the norm. You don't need the complexity of Windows DLLs
either, the toolchain handle most of the complexity

~~~
IshKebab
But that's only because Linux etc make it really stupidly difficult to
distribute apps in a Windows-like way. It's not because nobody wants to do it.

Look at the failure of autopackage and the recent Snap and Flatpak efforts for
proof of this.

~~~
geezerjay
> But that's only because Linux etc make it really stupidly difficult to
> distribute apps in a Windows-like way.

Actually, it does not. If that's what you want then you are free to implement
your windows-like installer. The process goes something like this:

* Install all binaries (executable and dynamic libraries) in a target directory (say, /opt/<your_app> or /usr/local/<your_app>)

* Create a shell script that sets the LD_LIBRARY_PATH to the directory where you've installed your program files and afterwards runs your application

* Run the application by launching the script

I would also like to add that the Windows-like process you've mentioned is
also a crude hack developed to get around Windows' DLL problem.

------
barrkel
This is a good introduction to a topic that very little is generally written
about, and is practically useful to few people outside operating systems and
compilers - and compilers usually use someone else's linker, although they
still need to know about relocations, fixups, external linkage schemes etc to
generate workable machine code.

If you squint a bit, there's a continuum between image-based languages like
Smalltalk and Lisp (optionally), where allocations persist across restarts,
and linkers, where the memory "allocation" happens at compile time and is only
used at runtime, through to smart linkers, which closely resemble the marking
and compacting phases of a simple garbage collector. The compiler needs to
advertise its roots, pointers and pointed to targets to the linker so that
relocations can work. Even fixups, the micro language that the linker needs to
evaluate when resolving symbols, has analogies with restoring an image - any
non-persistable references need to be restored.

~~~
slededit
C and C++ programmers could benefit from this. So many times I had to explain
an error message or problems that would be obvious if they knew how it worked.

------
unwiredben
Cool! I did a little review of this book back when I was the CodeWarrior for
Windows compiler/linker developer at Metrowerks. It's a really useful work.

------
frankzinger
Another take on the topic which has been passed around before here on HN:
[https://lwn.net/Articles/276782/](https://lwn.net/Articles/276782/).

------
Postosuchus
This is cool! Anyone bothered to re-assemble it into a single PDF?

~~~
pflanze
If you prefer the HTML pages for offline reading like I do, you can save
yourself the work of selectively downloading them and get the whole bunch
from: [http://christianjaeger.ch/scratch/www.iecc.com-linker-
only_h...](http://christianjaeger.ch/scratch/www.iecc.com-linker-
only_html.tgz)

The only change I made is to the www.iecc.com/linker/index.html file (to show
the icon for the html links).

~~~
pflanze
I have removed the file again.

------
gpapilion
I have a hard copy of this book. It was incredibly valuable when writing a
boot loader that understood the elf format.

~~~
lkuty
I have it too. I should read it one day. As well as dozens of other books.

------
dtornabene
curious how useful this would be given that the published date of the book is
2000 and this link is 1999. Serious question if anyone can answer it, I'm
getting into lowlevel work lately and would appreciate the education if its
still an accurate reflection of technique/technology.

~~~
theoh
I bought a copy back then out of curiosity (as a Linux user). It's an
excellent book, and I don't think many of the techniques described in it are
out of date. Things like the ELF format still form the infrastructure for
Linux binaries. There's a bit of historical info too, but IMO reading that is
analogous to reading about a language like C — it's of central importance if
you want to understand how and why these systems developed.

So, I would recommend it.

~~~
dtornabene
thanks for taking the time to respond, much appreciated.

