Using --make with -odir and hierarchical modules

Henrik Nilsson
Mon, 20 Jan 2003 01:46:02 -0500

Sven Panne wrote:

> Allowing leaf names to be equal is essential for the whole hierarchical
> module business!

Obviously, yes.
> Otherwise you would get evil non-local interactions
> between different modules. And in practice it doesn't seem to be a problem
> for ar/ld, because the base package and the GLUT package have lots of
> examples for equal leaf names (see below).


> I'm not sure how ar/ld handle
> this exactly, but I guess it works because of an index in the archive. From
> the Linux ar man page:

Yes, I did notice, as I wrote, that at least GNU ar seemed to cope with
putting many files having the same name into an archive if the archive is
built in a single operation. Maybe the index is instrumental in that.
Maybe not.

However, I can't really see how this would work if an archive is updated
incrementally, for example as per default Make rules.

For example, if an archive "fie.a" contains two "foo.o", and one does

  ar rv fie.a foo.o

then how could ar possibly know which "foo.o" to replace?

So I would be a bit nervous about putting files with the same names into
an archive. At least one has to be careful when constructing the archive
to make it work.

And if some libraries really rely on this, it would be
nice to know that this is universally supported by all ar programs, linkers,
compilers, etc.

Alternatively, maybe one should reconsider how object files are named.



Henrik Nilsson
Yale University
Department of Computer Science