pthreads
Hi all,
I am working on a pthread implementation to run under gnu mach for my
OS project this semester; expect to see some bits in the next month or
so.
Here is the problem that I have run into so far:
Background:
As a minimal implementation, I have a basic pthread_t, pthread_attr_t and
pthread_create.
When I try to link against the object that I create, I segmentation fault
_before_ I ever reach main:
Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) bt
#0 0x0 in ?? ()
#1 0x115136b in __register_frame_info () from /lib/libc.so.0.2
#2 0x103c360 in __libc_global_ctors () from /lib/libc.so.0.2
#3 0x105e3e5 in posixland_init () from /lib/libc.so.0.2
#4 0x105e4b9 in init1 () from /lib/libc.so.0.2
#5 0x2ff1 in _dl_start_user () at rtld.c:142
(gdb)
Even reducing the pthread_create routine to just a return yields the
same result. Not calling pthread create in the test program also
yields the same result (ie only linking with the object).
Here is what I have determined so far. There are pthread routines in
libc:
neal@hurd:/lib $ nm libc-2.1.2.so | grep pthread
U pthread_create
U pthread_getspecific
U pthread_key_create
U pthread_key_delete
U pthread_mutex_lock
U pthread_mutex_trylock
U pthread_mutex_unlock
U pthread_once
U pthread_setspecific
neal@hurd:/lib $
o If I rename pthread_create to something else, ie foo_pthread_create, it works
fine.
o If I don't link against my object then I am fine (and not call
pthread_create).
o If I call pthread create and don't link against the object (but supply my
own header file for the prototypes), I get unresolved symbols.
Thanks in advance,
-Neal
--
----------------------------------------------------------------------------
Neal Walfield neal@walfield.org
UMass Lowell - Fox 1512 Phone: 978-934-5347
Fax: 603-415-3645
Love is the triumph of imagination over intelligence.
-- H. L. Mencken
Reply to:
- Follow-Ups:
- Re: pthreads
- From: Marcus Brinkmann <Marcus.Brinkmann@ruhr-uni-bochum.de>