This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Why isn't __pthread_unwind linked?
- From: Nick Clifton <nickc at redhat dot com>
- To: Toru UCHIYAMA <uchi at cs dot fujitsu dot co dot jp>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 18 Nov 2003 15:02:59 +0000
- Subject: Re: Why isn't __pthread_unwind linked?
- References: <200311051216.hA5CGVQ06855@stbrain.utsfd.cs.fujitsu.co.jp>
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