General linking question

Stefan Bellon sbellon at
Wed Aug 28 08:02:27 PDT 2002

Ok, below comes a complete explanation of what I'm trying to achieve at
the moment. :-)

For the reply I just picked Tony's posting, but I'll quote the other
two as well.

Tony van der Hoff wrote:
> On 28 Aug 2002, in message <4b6d18f8aesbellon at>,
> Stefan Bellon <sbellon at> wrote:

> I've never used the -aof switch, and I'm not entirely sure what it
> does/means, but I suspect it would treat the entire contents of the
> library as a single object module, and thus cause the entirety of the
> library to be dragged in, which would explain your problem.

Ok, sounds reasonable.


> But why would you want to build a new library?

See below.

> >With (dr)link -aof you could link together files that have already
> >been linked with (dr)link -aof. You cannot do the same with libfile
> >or makealf.

> No, that seems entirely reasonable to me; ALF files are not linked;
> they are simply collections of unlinked object modules.

Ok, understood.

> > AOF Librarian:  (Error)  Bad library member oldlib.
> > ! Warning (makealf): object file oldlib has no header chunk.


> > What am I missing?
> > 
> Well, link allows you to specify a VIA file, which can contain all
> the object file names, so command line length should never be a
> problem. With a little effort you can even generate the VIA file from
> make.

Ok, this would be another work-around.

> However, I'm finding it hard to understand what you're trying to do.
> It sounds like you're abusing the ALF library system in order to work
> round your command line problem. Perhaps you shouldn't be using
> libraries at all?

See below.

Alex Waugh wrote:
> In message <4b6d18f8aesbellon at>
>           Stefan Bellon <sbellon at> wrote:

> > I have the problem that I hit the command line length (2048
> > characters as it seems) when linking. With (dr)link -aof I could
> > link together parts and then link those parts together. With
> > libfile or makealf this doesn't work.
> > 
> > What am I missing?

> Use libfile -i to add files to an existing library.  

Yes, but it gets messy this way as well. See below.

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


> > Ok, but now I have a problem: How do I create a new library from a
> > few other libraries? With (dr)link -aof you could link together
> > files that have already been linked with (dr)link -aof. You cannot
> > do the same with libfile or makealf. You get:
> >
> > AOF Librarian:  (Error)  Bad library member oldlib.

> I've never seen this.  OpenSSH (for one) does this (albeit using the
> ar frontend instead).  It would help if you showed us the complete
> commmand line.

Ok, I'll do as soon as you all tell me that I'm not doing something
stupid here.

Now let's have a look at the hole story:

Because GnuPG is under GPL and the IDEA algorithm is patented, I cannot
supply an already linked binary of GnuPG. Instead I have to supply a
"partially linked" GnuPG in one archive and the idea.o in the other
such that the user only has to link it together (with the supplied
drlink and a simple obey file).

I want to keep as close as possible to the original GnuPG structure.
Under GNU/Linux, there are the following directories and from all files
inside them, libraries are generated:


In addition there's "g10" inside which the main application resides.
So, we have five libraries and the main object files inside g10 that
produce gpg when linked together. So far, so good.

Now, for the IDEA support, I have to link together everything apart
from idea.o, even UnixLib has to be linked in. The problem is, how to
link together the five libraries with the UnixLib and the object files
inside g10 in a way that only idea.o is missing and needs to be linked
against the whole lot to result in a running gpg binary with IDEA

My first attempt was to create the libraries with "link -aof". This
worked as you can link those again. But the problem that started this
thread arose.

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

No problem I thought, just link all the object files themselves
together and not the five libraries. But then I hit the command line
length limit.

So, how do I do it "properly"?

Thanks for your help and ideas.

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

 WOMAN.ZIP - Great program but no documentation.

More information about the gcc mailing list