From: pmacdona@sanjuan (Peter MacDonald)
Subject: shared libs and building .a's
Date: 7 Jun 92 15:00:19 GMT
Organization: University of Victoria, Victoria, BC, CANADA
I am reposting this, cause I think the last one got lost:
There are two ways that I use to build .a's
1) Modify the makefile to add a progname.a target, which is a modification
of the progname target, by changing:
gcc -O -g -o progname -Ddef1 -Ddef2 ...
ld -r -x -o progname.a ...
Ensure that you get rid of the -g, as it wastes much space.
2) Do a
make >& make.out
and then edit make.out as above, to create a shell script.
Now to answer the question: why doesn't linux build the linker into the
kernel, and do dynamic linking?
- Linus came up with this nifty method that utilizes features of the
gnu linker to implement shared libs, that requires virtually no
kernel mods. ie. Simple and almost no work required.
- Demand loading would be complicated by dynamic linking, because clean
pages are currently discarded, and reloaded upon demand, from disk.
- Dynamic linking wouldn't solve all problems, because header files
(ergo the interfaces) in Linux change frequently, which even with
dynamic linking would still require recompilation of applications.
- Because no symbol tables are needed, Linux shared images are smaller.
So are the shared lib images for the same reason.
- Most disadvantages of shared libs would be overcome, if people would
post .a's instead of compiled images.
..A's are not hard to build, nor to install on a system with gcc.
I don't know how it is for other people with smaller memories, but I have a
directory with over 3 Meg in 120 files, and I can relink the whole bunch in
less than two minutes. I would like to amass an entire working /usr/bin
and post it, broken up into 1.2 Meg chunks. The distribution could be broken
up into two groups. The first group would be the base (you could still
delete what you don't want), and the second would be a collection of
optionals (like X applications, uucp/mail, ka9q, etc). Many people do not
would like to use a good Unix OS like Linux, but don't want to dick around
for weeks sewing all the pieces together.
Some things are missing though
like emacs, gdb, mount, and many others.