This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re*2: Why isn't __pthread_unwind linked?


Dear Nick
I am sorry. My reply was slow...

> Hi Toru UCHIYAMA,
> 
> > But if pthread program using pthread_exit() is compiled and
> > performed, segmentation fault will occur.  A __pthread_unwind
> > function is assigned to the 0x0x10000000.
> 
> I assume that you have traced the segmentation fault in pthread_exit()
> to the call to __pthread_unwind() ?
Yes. calling sequence is shown below.
__pthread_exit->__do_cancel->__pthread_unwind

# Shared linking is no probrem.

> > Why isn't __pthread_unwind linked ? Any ideas ?
> 
> It must be because there is no unresolved reference to
> __pthread_unwind at the point when libpthread.a is included.  You
> could try adding:
> 
>    -Wl,--undefined=__pthread_unwind
> 
> to the GCC command line before the -lpthread, as a workaround for the
> problem.
> 
Thank you for your wonderful advice. It went well.  :-)
 __pthread_unwind is no longer linked to the 0x10000000.

[before]
1000218c <__pthread_exit>:
1000218c:       94 21 ff f0     stwu    r1,-16(r1)
10002190:       7c 08 02 a6     mflr    r0
10002194:       90 01 00 14     stw     r0,20(r1)
10002198:       90 62 8d 90     stw     r3,-29296(r2)
1000219c:       39 62 8b f4     addi    r11,r2,-29708
100021a0:       39 40 00 10     li      r10,16
100021a4:       80 0b 00 00     lwz     r0,0(r11)
100021a8:       7c 09 53 78     or      r9,r0,r10
100021ac:       7d 00 58 28     lwarx   r8,r0,r11
100021b0:       7d 00 40 51     subf.   r8,r0,r8
100021b4:       40 82 00 0c     bne-    100021c0 <__pthread_exit+0x34>
100021b8:       7d 20 59 2d     stwcx.  r9,r0,r11
100021bc:       40 a2 ff f0     bne-    100021ac <__pthread_exit+0x20>
100021c0:       4c 00 01 2c     isync
100021c4:       2f 88 00 00     cmpwi   cr7,r8,0
100021c8:       40 be ff dc     bne-    cr7,100021a4 <__pthread_exit+0x18>
100021cc:       80 62 8b f0     lwz     r3,-29712(r2)
100021d0:       4b ff de 31     bl      10000000 <data.0+0xfffffd8>

[after (with -Wl, -Wl,--undefined=__pthread_unwind]
100021fc <__pthread_exit>:
100021fc:       94 21 ff f0     stwu    r1,-16(r1)
10002200:       7c 08 02 a6     mflr    r0
10002204:       90 01 00 14     stw     r0,20(r1)
10002208:       90 62 8d 90     stw     r3,-29296(r2)
1000220c:       39 62 8b f4     addi    r11,r2,-29708
10002210:       39 40 00 10     li      r10,16
10002214:       80 0b 00 00     lwz     r0,0(r11)
10002218:       7c 09 53 78     or      r9,r0,r10
1000221c:       7d 00 58 28     lwarx   r8,r0,r11
10002220:       7d 00 40 51     subf.   r8,r0,r8
10002224:       40 82 00 0c     bne-    10002230 <__pthread_exit+0x34>
10002228:       7d 20 59 2d     stwcx.  r9,r0,r11
1000222c:       40 a2 ff f0     bne-    1000221c <__pthread_exit+0x20>
10002230:       4c 00 01 2c     isync
10002234:       2f 88 00 00     cmpwi   cr7,r8,0
10002238:       40 be ff dc     bne-    cr7,10002214 <__pthread_exit+0x18>
1000223c:       80 62 8b f0     lwz     r3,-29712(r2)
10002240:       48 00 09 2d     bl      10002b6c <__pthread_unwind>


> Presumably the pthread_exit() code should contain an undefined
> reference to __pthread_unwind, so I would suggest that you investigate
> how this function was compiled and what has happened to this
> reference.

When some are understood, I will post to a mailing list again.

> 
> Cheers
>         Nick
>         
Sincerely Yours

Toru UCHIYAMA


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]