General linking question

Stefan Bellon sbellon at
Wed Aug 28 08:48:56 PDT 2002

Peter Naulls wrote:
> In message <4b6d23436bsbellon at>
>           Stefan Bellon <sbellon at> wrote:

> > Then I switched to libfile, but now I cannot link the five libraries
> > together once more when doing the partially linked binary for IDEA
> > support.

> This is certainly what you want to do.  5 ALF libraries, then finally
> linked to a binary.

That's what I'm doing at present. I ship in one archive: 5 ALF
libraries and one further file which contains all files from g10
"partially linked" together in one AOF file (I cannot use libfile here,
as otherwise I lose main(), right?). Ah, and not to forget UnixLib
itself! And in the second archive, there's idea.o.

But I dislike the idea to have to ship 6 object files in the one
archive. It would be simpler for the user (who doesn't even know what
compiling or linking means) if there was just one such file present.

> I'll clarify some terms here.   "partially linked" usually refers to
> the AOF object format, although technically speaking ALF could also be
> termed as this.  The -aof option takes several object files and spits
> out a larger one.  Libfile simply bundles object files together, which
> essentially remain as seperate entities.

Yes, thanks. :-)

> The -aof option really is to be avoided if you can, as amoung other
> things your binary will probably end up larger (as a result of issues
> already dicussed). 

The funny thing is, since I use "libfile" and not "drlink -aof", the
size of gpg has grown from 736K to 756K. Not a problem for me, but
perhaps for people wanting to use it on A5000 machines.

> Exceptions may arise you have a problem that I currently do of
> libfile creating broken libraries.


> So I would expect to see something like in OpenSSL, where Libfile -i
> (or ar equivalent) is repeatedly called to increase the library size
> in each directory with objects there, then finally link later on with
> the main program to create the final binary.

Ok, then I'll try this one.

This way I need three files in the one archive (instead of seven):

* the library created from all object files
* the object file containing main() as this cannot go into the library
* the UnixLib library

It works and the gpg executable is 744K in size.

Can this still be improved?

 Stefan Bellon * <mailto:sbellon at> * <>
 PGP 2 and OpenPGP keys available from my home page

 Microsoft? Is that some kind of toilet paper?

More information about the gcc mailing list