[LLVMdev] Re: pthread?

yue qiangyue at ict.ac.cn
Wed Dec 24 01:30:01 PST 2003


ok, using
lli -load=libpthread.so.0 pthread.ll.bc

yueqiang


Chris Lattner wrote:

>On Wed, 24 Dec 2003, yue wrote:
>
>  
>
>>I try to run lli with "--load=/lib/libpthread.so", but it shows:
>>---------------------------------------------------
>>[yue at RH9 test]$ ./pthread.ll
>>Error opening '/lib/libpthread.so.0': /lib/libpthread.so.0: symbol
>>_errno, version GLIBC_2.0 not defined in file libc.so.6 with link time
>>reference
>>  -load request ignored.
>>    
>>
>
>This is strange, I have no idea why this is happening.  Maybe you have
>mixed versions of different libraries installed on your system?  Maybe
>your compiled version of LLI is not up-to-date?
>
>I was able to use 'lli -load=libpthread.so.0 a.out.bc' and that worked for
>me, note the lack of an absolute path.
>
>  
>
>>then try to run with "--load=/usr/lib/libpthread.so", it shows:
>>--------------------------------------------------
>>[yue at RH9 test]$ ./pthread.ll
>>Error opening '/usr/lib/libpthread.so': /usr/lib/libpthread.so: invalid
>>ELF header
>>    
>>
>
>That's because it is trying to use the linker script as a shared object
>and getting unhappy about it.  It would be nice if LLVM supported linker
>scripts better, precisely to make these sorts of problems disappear, but
>noone has tackled that yet.
>
>Actually, while I'm thinking about it, I should throw a disclaimer in
>here.  The JIT does not yet have locking in place to protect its internal
>data structures from multiple threads.  Because of this you might get
>'recursive compilation detected' aborts when you finally get your threaded
>program to load the correct libraries.  As a work-around, you can compile
>the program with the 'llc' utility to native code, link it with the
>pthreads libraries, then execute it.  Another advantage of this, is that
>it lets the GCC compiler driver parse the linker script and figure out
>what to do with it.
>
>To use this, try something like this:
>
>$ llvmgcc foo.c -o foo   # or however you compile your program to .bc
>$ llc foo.bc -o foo.s
>$ gcc -pthread foo.s -o foo
>$ ./foo
>
>-Chris
>
>
>  
>
>>yue wrote:
>>
>>    
>>
>>>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
>>
>>    
>>
>
>-Chris
>
>  
>





More information about the llvm-dev mailing list