Partial linking - why?

Alexandre Oliva aoliva@redhat.com
Wed Feb 19 03:29:00 GMT 2003


On Feb 17, 2003, Tom Tromey <tromey@redhat.com> wrote:

>>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:
Andrew> When linking libgcj, we first do a few partial links and then
Andrew> link the shared object.  Perhaps that's because otherwise the
Andrew> line would be too long.  But why do we do this, rather than
Andrew> making an archive and linking that with --whole-archive?

> I don't know.  Maybe Alexandre knows; I CCd him.

This would be a nice optimization for libtool, but it doesn't know how
to do it ATM.  Besides, it wouldn't help for all targets, since there
are targets that don't support --whole-archive or equivalent.

If you'd like to take this route, you may consider creating a
convenience library out of the object files used to build libgcj, and
then link this convenience library into libgcj.  You'll then get the
effect you want, with the exception that the convenience library won't
be removed as soon as the shared library is created.  Also, because of
a bug in libtool (or a limitation of convenience libraries, if you
will :-), you'll find that, when you build both a static and a shared
version of libgcj using a convenience library, even the static version
will have PIC objects, since the convenience library is always
built out of (only) PIC objects, if they're available.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Java mailing list