Pthread initialization

Wesley Gonçalves wesley@lisha.ufsc.br
Tue Jul 24 19:11:00 GMT 2012


Hello all,

I'm integrating a linux OS with sparc-leon3 processor. The linux
kernel is built with a Crosstool-ng based toochain, downloaded from
Gaisler website. It generates the toolchain using the glibc 2.9. I
built my linux image with buildroot and the kernel does boot and
login. However, pthreads apps isn't working very well on the system.
Have somebody here worked with pthreads on the sparc architecture?

These problems with pthreads arises even on simpler programs, as in
this C code example, attached to the e-mail. It seems that the stack
couldn't be allocated , returning the following error:
allocate_stack: Assertion `size != 0' failed.

Adding some debugging code in ntpl/allocatestack.c and ntpl/init.c, I
realize that stack size and address returned by the pthreads API call
are always returning NULL and that
__pthread_initialize_minimal_internal is not being called.  The
disassembled code shows that the _init function in
sysdeps/generic/initfini.c is called, but the function _init in
ntpl/sysdeps/pthread/pt-initfini.c (which initializes the stack size)
isn't. Is this the reason of my problem?

What do I have to do in order to call the _init in
ntpl/sysdeps/pthread/pt-initfini.c?

Here the .init section of my program:
Disassembly of section .init:

000103c4 <_init>:
   103c4: 9d e3 bf a0 save  %sp, -96, %sp
   103c8: 40 00 00 18 call  10428 <call_gmon_start>
   103cc: 01 00 00 00 nop
   103d0: 40 00 00 44 call  104e0 <frame_dummy>
   103d4: 01 00 00 00 nop
   103d8: 40 00 00 bf call  106d4 <__do_global_ctors_aux>
   103dc: 01 00 00 00 nop
   103e0: 81 c7 e0 08 ret
   103e4: 81 e8 00 00 restore

Thanks in advance,
Wesley Gonçalves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread_ex.c
Type: text/x-csrc
Size: 557 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-help/attachments/20120724/c86d6975/attachment.bin>


More information about the Libc-help mailing list