[LLVMdev] pthread?
Chris Lattner
sabre at nondot.org
Wed Dec 24 00:04:03 PST 2003
On Tue, 23 Dec 2003, Kevin Gibbs wrote:
> Try
> llvmgcc pthread.c -o pthread.ll -pthread
>
> You have to link in the pthreads library, and I believe -pthread is all you
> need on a redhat 9 box.
Yup, in theory this should work. However, in practice it looks like it
doesn't, on redhat 8 at least. The problem is that (in RH8)
/usr/lib/libpthread.so is not actually a library, it's a linker script.
Because of this you might need to edit the script generated by gccld (the
pthread.ll file in your case) to pass '--load libpthread.so.0' into lli
before the $0.bc argument. This should give you something like this:
---
#!/bin/sh
lli \
--load=/lib/libpthread.so.0 \
$0.bc $*
---
I think that will work. If it doesn't, please let me know. You might
have to adjust the .so file name to be whatever the linker script says, if
necessary.
-Chris
> > -----Original Message-----
> > From: llvmdev-admin at cs.uiuc.edu [mailto:llvmdev-admin at cs.uiuc.edu] On
> > Behalf Of yue
> > Sent: Tuesday, December 23, 2003 11:43 PM
> > To: llvmdev at cs.uiuc.edu
> > Subject: [LLVMdev] pthread?
> >
> > hi,
> >
> > I compile a pthread program using llvmgcc, but when i run pthread.ll, it
> > show:
> > ------------------
> > [yue at RH9 test]$ llvmgcc pthread.c -o pthread.ll
> > [yue at RH9 test]$ ls
> > pthread pthread.c pthread.ll pthread.ll.bc
> > [yue at RH9 test]$ ./pthread.ll
> > Creating thread 0
> > WARNING: Cannot resolve fn 'pthread_create' using a dummy noop function
> > instead!
> > ERROR; return code from pthread_create() is -1073745164
> > [yue at RH9 test]$
> > --------------------
> > how to solve the problem?
> >
> > yueqiang
> > 2003/12/24
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-Chris
--
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/
More information about the llvm-dev
mailing list