One difference between uClibc and glibc

Mike Frysinger vapier at gentoo.org
Thu Mar 23 06:44:16 UTC 2006


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 ...

so let's take sprintf.c for example:
libc_hidden_proto(vsnprintf)
libc_hidden_proto(sprintf)
int sprintf(....) {
	vsnprintf(...)
}
libc_hidden_def(sprintf)

libc_hidden_proto() creates hidden prototypes __GI_sprintf() and 
__GI_vsnprintf() ... then when sprintf() calls vsnprintf(), it's actually 
calling __GI_vsnprintf() ... the libc_hidden_def() is what actually defines 
the __GI_sprintf() symbol to point to sprintf()

then if we look at vsnprintf.c:
libc_hidden_proto(vsnprintf)
int vsnprintf(...) {
	...
}
libc_hidden_def(vsnprintf)

here we have the __GI_vsnprintf() prototyped for us with libc_hidden_proto() 
and then the libc_hidden_def() actually defines the __GI_vsnprintf() symbol 
to point to vsnprintf()

hope that was clear ... i sort of brain dumped ;)
-mike



More information about the uClibc mailing list