Buildroot fails on MIPS32 in uclibc

Denys Vlasenko vda.linux at googlemail.com
Tue Dec 9 00:38:37 UTC 2008


On Tuesday 09 December 2008 00:45, Rob Landley wrote:
> On Saturday 29 November 2008 15:44:20 Denys Vlasenko wrote:
> > On Saturday 29 November 2008 18:18, Alexander Voropay wrote:
> > > Hi!
> > >
> > >  I have the same error under Linux (OpenSUSE) with current
> > > uClibc snapshot and have no such probles with uClibc 0.9.29 release.
> >
> > libc/sysdeps/linux/mips/bits/socket.h needs libc_hidden_proto here:
> >
> >
> >  extern struct cmsghdr * __NTH (__cmsg_nxthdr (struct msghdr *__mhdr,
> >                                       struct cmsghdr *__cmsg)) __THROW;
> > +libc_hidden_proto(__cmsg_nxthdr)
> 
> Is there any documentation on libc_hidden_proto()?  I read the big comment 
> block in include/libc-symbols.h and I'm pretty sure PLT is Procedure Linkage 
> Table from the ELF spec

Well, I edited that comment trying to make it more clear.
I am sure it will benefit from more passes at it.

> and I vaguely recall weak symbols are ones that the  
> linker remembers but doesn't stop at, so it'll only use that linkage if it 
> doesn't find a non-weak definition of the same symbol later on.

My understanding too.

> Anyway, is there something I should be reading here to get properly up to 
> speed on this instead of being vaguely confused in passing, as I've been for a 
> while now?

I guess we need to work together on it.


extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
     __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (2)));
libc_hidden_proto(ptsname_r)

My understanding is that libc_hidden_proto(ptsname_r) turns into

extern __typeof (ptsname_r) ptsname_r __asm__ ("" "__GI_ptsname_r") __attribute__ ((visibility ("hidden")));


and libc_hidden_def:

int ptsname_r (int fd, char *buf, size_t buflen)
{
...
}
libc_hidden_def(ptsname_r)

turns into:

extern __typeof (ptsname_r) __EI_ptsname_r __asm__("" "ptsname_r");
extern __typeof (ptsname_r) __EI_ptsname_r __attribute__((alias ("" "__GI_ptsname_r")));


So, "ptsname_r" is now a (non-hidden) alias to __GI_ptsname_r,
and __GI_ptsname_r is hidden.

Whenever libc calls ptsname_r, gcc makes that a call to __GI_ptsname_r.
Since it is hidden, the call is short-circuited to be a local
call in uclibc.so.

Whenever user application calls ptsname_r, it really calls ptsname_r
(because installed headers have libc_hidden_proto(xxx) lines deleted).
So the call goes to as usual.

The stupid part here is why __GI_ptsname_r is a real name of the routine,
and ptsname_r is an alias? Why not make it the other way around:
ptsname_r is a real name, and __GI_ptsname_r (or __HIDDEN_ptsname_r)
is a (hidden) alias? I imagine binutils had bugs with hudden aliases?.

Also, it is all done even for static lib, which is pointless
(and harmless, though).
--
vda



More information about the uClibc mailing list