One difference between uClibc and glibc

Rich Felker dalias at aerifal.cx
Thu Mar 23 10:57:16 UTC 2006


On Thu, Mar 23, 2006 at 03:51:53PM +0800, Jie Zhang wrote:
> On 3/23/06, Mike Frysinger <vapier at gentoo.org> wrote:
> > On Thursday 23 March 2006 01:29, Jie Zhang wrote:
> > > On 3/23/06, Mike Frysinger <vapier at gentoo.org> wrote:
> > > > On Wednesday 22 March 2006 00:16, Jie Zhang wrote:
> > > > > What do you think?
> > > >
> > > > this fix is fine for all versions of uClibc released thus far released,
> > > > but i'm pretty sure (99%) that this isnt an issue for current uClibc svn
> > > > (and thus for the next 0.9.29 release) ... since psm's changes to hide
> > > > relocations against internal symbols in libc.so, snprintf() now calls an
> > > > internal alias to vsnprintf() rather than having the symbol be processed
> > > > at runtime ... same goes for all other such i/o functions ...
> > >
> > > But that's only for shared library.
> >
> > no, it's for all objects ... the libc_hidden_* macro's create aliases
> > automatically for us ...
> >
> If you read /include/libc-symbols.h, you will see:
> 
> #if !defined STATIC && !defined __BCC__
> ...
> #else /* SHARED */
> ...
> # define hidden_def(name)
> # define hidden_data_def(name)
> # define hidden_weak(name)
> # define hidden_data_weak(name)
> #endif /* SHARED */
> 
> You can test it using i386 arch with both PIC and shared library options off.

Even if these macros were defined 'correctly' for static libs, they
would not do what you expect. This sort of hidden symbol hack only
works in (elf) shared libraries by bypassing the elf mechanisms that
would emulate the behavior of static libraries. It might also be
possible if you linked the entire .a file into a single .o file, but
this is most certainly not something you want to do...

Rich




More information about the uClibc mailing list