Re: Segmentation fault in __libc_start_main with -static

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 27, 2010 at 12:06 PM, John David Anglin
<dave@xxxxxxxxxxxxxxxxxx> wrote:
> In trying to debug a new gcc testsuite failure, I tried to link the
> application with -static to simplify debugging.  It turns out we have
> a couple of problems in linking threaded applications with -static.

Thanks for looking into this.

> The first problem is the linker does change r19 to dp for various TLS
> relocations using the global pointer.  I've attached a patch below
> to which I think fixes this problem.

OK.

> The second issue is the handling of the symbol __nptl_threads.
> We get a segmentation fault at startup here:
>
> 0x000223bc <__libc_start_main+600>:     addil L%0,r0,r1
> 0x000223c0 <__libc_start_main+604>:     ldo 0(r1),r3
> 0x000223c4 <__libc_start_main+608>:     ldw 0(r3),rp
>
> The relocations are:
>
> 00000258 R_PARISC_DPREL21L  __nptl_nthreads
> 0000025c R_PARISC_DPREL14R  __nptl_nthreads
>
> The original code:
>
>  258:   2b 60 00 00     addil L%0,dp,r1
>  25c:   34 23 00 00     ldo 0(r1),r3
>  260:   0c 60 10 82     ldw 0(r3),rp
>
> __nptl_nthreads is undefined weak:
>
>         w __nptl_nthreads

The symbol is defined in libpthread.so, specifically by
nptl/pthread_create.c "unsigned int __nptl_nthreads = 1;"

Application link map shows:
 .data          0x000a1648       0x14
/usr/lib/gcc/hppa-linux-gnu/4.3.4/../../../libpthread.a(pthread_create.o)
                0x000a1648                __nptl_nthreads

I don't see any segmentation fault, nor do I see an undefined weak
__nptl_nthreads:

  1600: 000a1648     4 OBJECT  GLOBAL DEFAULT   21 __nptl_nthreads

You need to provide me with more data about how the application is
built, it looks like your link might be incorrect.

Cheers,
Carlos.
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux