static link with NPTL on ARM fails

Johannes Stezenbach js at sig21.net
Fri Dec 16 14:57:08 UTC 2011


On Tue, Nov 29, 2011 at 04:51:35PM +0100, Johannes Stezenbach wrote:
> On Mon, Nov 28, 2011 at 10:51:04PM +0100, Bernhard Reutner-Fischer wrote:
> > On Nov 28, 2011 6:43 PM, "Johannes Stezenbach" <js at sig21.net> wrote:
> > >
> > > I'm in the process of building a toolchain with crosstool-ng,
> > > with uClibc-0.9.32 + NPTL for ARM926EJ-S.
> > >
> > > Trying to statically link a simple testcase with NPTL fails:
> > >
> > > $ cat t.c
> > > #include <pthread.h>
> > >
> > > int main(int argc, char *argv[])
> > > {
> > >        return (int)pthread_create;
> > > }
> > > $ arm-linux-gcc -Wall -Os t.c -lpthread -static -Wl,-Map=m
> > >
> > /tmp/tc/arm-unknown-linux-uclibcgnueabi/arm-unknown-linux-uclibcgnueabi/sysroot/usr/lib/libc.a(sigaction.o):
> > In function `__libc_sigaction':
> > > sigaction.c:(.text+0x0): multiple definition of `__libc_sigaction'
> > >
> > /tmp/tc/arm-unknown-linux-uclibcgnueabi/arm-unknown-linux-uclibcgnueabi/sysroot/usr/lib/libpthread.a(pt-sigaction.o):pt-sigaction.c:(.text+0x0):
> > first defined here
> > 
> > Can you reproduce this with current master?
> 
> Yes.  I get exactly the same failure.

I was able to fix the issue like this:

--- uClibc-0.9.33/libpthread/nptl/sysdeps/pthread/sigaction.c.orig	2011-12-03 18:55:45.000000000 +0100
+++ uClibc-0.9.33/libpthread/nptl/sysdeps/pthread/sigaction.c	2011-12-14 11:48:52.000000000 +0100
@@ -38,9 +38,9 @@
 
   return __libc_sigaction (sig, act, oact);
 }
-libc_hidden_proto(sigaction)
+hidden_proto(sigaction)
 weak_alias (__sigaction, sigaction)
-libc_hidden_weak(sigaction)
+hidden_weak(sigaction)
 
 #else
 

I still think that the root cause is that libc_hidden_proto() etc. are
enabled for static build at all, but it's not easy to change,
and apparently noone wants to even discuss it ;-/
If you agree on the above I'll resend with proper description
and s-o-b.

I only tested lightly (compiled and run a static iperf).


Thanks
Johannes


More information about the uClibc mailing list