[patch] init_array/fini_array support

John Bowler jbowler at acm.org
Tue Jan 31 18:15:17 UTC 2006


RE: PATCH: Make environ a weak alias to __environ

I don't understand what is going on here.  In 0.9.28 it doesn't
work at all on ARM uclibc to have a weak alias in a DLL, i.e.
it doesn't work at all to define a visible DLL symbol weak.  It
works fine on ARM glibc.

See the comment in ldso/dl-hash.c "Perhaps we should support old
style weak symbol handling per what glibc does when you export
LD_DYNAMIC_WEAK." - the code to handle weak symbols is commented out.

What this means is that, on uclibc alone, ld.so simply ignores weak
symbol definitions in a DLL - so if you don't have a strong one the
symbol will be undefined.

I encountered this on thumb because the 'undefined' symbol for a
thumb function appeared, in this context, to be a definition (because
of the setting of the low bit) and ld.so ended up calling an SHN_UNDEF
(value==1) function in preference to the weak definition (in the case
when the strong one is absent.)

This is the reason for the core parts of 20060120-thumb-resolve.patch in:


Anyway, I don't understand why *not* having weak symbol handling in
ld.so is correct, but Joakim Tjernlund made this comment:

From: Joakim Tjernlund [mailto:joakim.tjernlund at transmode.se]
Sent: Sunday, January 22, 2006 4:22 AM
To: jbowler at acm.org; uclibc at uclibc.org
Subject: RE: uClibc ARM thumb support

> The dl_hash.c changes does not look sane to me, looks like you
> have restored the old WEAK procedure(among some other stuff that
> I don't understand yet)? Why? 

So I'm missing something here - in 0.9.28 there was no *new* WEAK
procedure (in so far as weak symbols were not being resolved), maybe
there is a new one and it is broken?

John Bowler <jbowler at acm.org>

More information about the uClibc mailing list