Pthread initialization

Wesley Gonçalves wesley@lisha.ufsc.br
Wed Jul 25 20:35:00 GMT 2012


Hi guys,

I have news! I made an workaround. As mentioned in
http://www.poared.com/wordpress/?p=79, I modified the file
ntpl/init.c, setting  the function
_pthread_initialize_minimal_internal (void) as constructor. I applied
the patch attached.

Now, apparently it's working. However, I don't know what are the
impacts in this modification. How do you evaluate that?

Wesley

2012/7/24 Wesley Gonçalves <wesley@lisha.ufsc.br>
>
> 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: ct-fix-pthread.patch
Type: application/octet-stream
Size: 455 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-help/attachments/20120725/0909f1c7/attachment.obj>


More information about the Libc-help mailing list