[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libtool: link order problem affecting gij

From: Alexandre Oliva
Subject: Re: libtool: link order problem affecting gij
Date: 16 May 2001 03:18:58 -0300
User-agent: Gnus/5.090002 (Oort Gnus v0.02) XEmacs/21.1 (Cuyahoga Valley)

On May 16, 2001, Bryce McKinlay <address@hidden> wrote:

> Jeff Sturm wrote:
>> On Sun, 13 May 2001, Bryce McKinlay wrote:
>> > libtool inserting lib flags ("-lgcc_s -lc -lgcc_s") into the gcj link
>> > command line _before_ other lib flags which we are passing to it. This
>> > means that libc is being linked before libpthread, which is bad:
>> Yeah.  This has been happening for a little while:

>> Does Zack's patch help?
>> By eliminating libsupc++ from the build, its side effects (linking with
>> explicit -lc) should go away.

> Zack's patch does indeed fix this problem and I notice that he has checked
> it in. Thanks Zack!


FYI, my current inclination is to arrange for libtool to not add to a
library's dependencies any switches passed implicitly by the compiler
driver to the linker.  I'm not convinced this is right at all times
(perhaps only for convenience libraries?), but it would have avoided
this problem.

To clue other libtoolers into the problem: libjava is thread-aware, so
it must be linked with the thread library.  However, the thread
library must be linked in before the regular (thread-unaware) C
library.  The problem seems to be that libtool was picking the
dependency list from a C++ convenience library, that included the
shared libgcc and libc, as above, which resulted in libc being linked
in before the thread library.

One simple solution would have been to move -lpthread first in the
list of dependencies of libjava.  But I'd hope libtool might be more
helpful in cases in which library ordering matters so much.  I'm not
sure we should introduce thread-awareness in libtool (actually, extend
the almost-do-nothing already-existing thread flag) or somehow adjust
libtool such that the postdeps of the compiler are handled as a unit,
or something like that.

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  address@hidden,}
CS PhD student at IC-Unicamp        address@hidden,}
Free Software Evangelist    *Please* write to mailing lists, not to me

reply via email to

[Prev in Thread] Current Thread [Next in Thread]