This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: #ifndef SHARED in pthread.h


On Mon, Jun 4, 2012 at 2:30 PM, Siddhesh Poyarekar <siddhesh@redhat.com> wrote:
> On Mon, 4 Jun 2012 14:19:13 -0400, Carlos wrote:
>> If there is no other definition, and this is an internal function that
>> we wouldn't allow users to override, then the entire conditional block
>> should just be deleted?
>
> It looks like the static build of libpthread.a has a weak definition of
> the function so that if a binary ends up with a mixed environment
> resulting in a statically linked libpthread.a and a dynamically loaded
> copy, the latter should be preferred. Not sure how that will help while
> declaring an extern in the public header though; it should be ok
> to just remove it.

The weakness of the symbol is currently only used when static linking
(unless LD_DYNAMIC_WEAK is also set).

At runtime the application should continue to use the statically
linked libpthread.a and *not* the dynamically loaded libpthread.so.

So I guess the weak-ness of the symbol has to be preserved for people
running with LD_DYNAMIC_WEAK where the strong versions in the DSO
override the weak symbols in the executable?

In light of that the code can't be changed without preserving the
existing behaviour:

* Set the symbol weak in the static link.

* Set the symbol non-weak in the dynamic link.

Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]