LLBMC with external libraries?

34 views
Skip to first unread message

Phong Ngo

unread,
Aug 15, 2015, 6:33:56 AM8/15/15
to LLBMC
Hi,

Do you know LLBMC will work with an external libaries or not?

I have a test file using pthread bellow.

When I compile:

> clang -c -g  -emit-llvm -pthread test.c -o test.bc
> llbmc test.bc 

Then llbmc returns an error because pthread_create function is not defined.

Could I pass some options for clang or llbmc to work with external libraries?
For example in this case pthread posix.

Thank!

Best regards,
Phong


#include <stdio.h>
#include <pthread.h> 
void *f1(void *arg){
  pthread_exit(0); 
}
void *f2(void *arg){
  pthread_exit(0); 
}
int main
() { pthread_t t1, t2; pthread_create(&t1,NULL,f1,NULL); pthread_create(&t2,NULL,f2,NULL); pthread_join(t1,NULL); pthread_join(t2,NULL);
  return 0;
}

pavlos pseftoyiannis

unread,
Dec 18, 2020, 5:39:15 PM12/18/20
to LLBMC
Hi Phong, 

  In case of the fact that LLBMC seems to be deprecated (i could not download the LLBMC package on my UBUNTU 20.04 system) , i' ve found the solution temporarily with the following command :

  clang -S -emit-llvm test.c

As a result of that command , a new file test.ll generated. This file is a Links Language Template File, which you can analyze with the help of Flex that creates a deep lexical analysis.

  I also found how you can run the file test.c through the following walkthrough :
    Firstly , insert the command on line 15 of your source code test.c  :   printf("thread t1 was created.");  
     run these commands :
           gcc -pthread -o test test.c
          
           ./test

That's all.


Yours sincerely ,

  Pavlos Pseftoyiannis
Reply all
Reply to author
Forward
0 new messages