Why isn't __pthread_unwind linked?
Nick Clifton
nickc@redhat.com
Tue Nov 18 15:05:00 GMT 2003
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() ?
> Of course, libpthread.a contains unwind.o. and the extract of a
> result which performed nm -a is shown below.
> 00000080 W __pthread_unwind
> '--verbose' print is below.
> attempt to open /home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a succeeded
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)pthread_create.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)pthread_exit.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)pthread_join.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)cleanup_compat.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)cancellation.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)lowlevellock.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)init.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)events.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)pthread_once.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)sigaction.o
> (/home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libpthread.a)errno-loc.o
> attempt to open /home/xgcc/exper/1001/powerpc-405-linux-gnu/lib/libgcc.a failed
> 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.
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.
Cheers
Nick
More information about the Binutils
mailing list