1

I generated a .ll file using llvm-gcc for a Openmp program(written in c).
Then Optimized using opt(version 3.0)
But when I try to execute the optimized .ll file using lli or llvm-ld, getting the following errors,

        LLVM ERROR: Program used external function 'GOMP_parallel_start' which could not be resolved!

Here is the step I followed,

   $ llvm-gcc -emit-llvm loop11.c -fopenmp -o loop.ll -S
   $ opt -O3  loop.ll -o loop.opt.ll -S
   $ lli loop.opt.ll
    LLVM ERROR: Program used external function 'GOMP_parallel_start' which could not be resolved!

Please help me to solve this problem.
Thanks in advance.

shashikiran
  • 369
  • 1
  • 5
  • 17

1 Answers1

3

You have to link / load the OpenMP runtime, libgomp in this case.

Anton Korobeynikov
  • 9,074
  • 25
  • 28
  • I tried linking OpenMP runtime libgomp, [[$llvm-ld -l="/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/libgomp.a" op.bc]] getting same error. – shashikiran Mar 07 '12 at 04:16
  • 2
    This will work only if you're using llvm-ld to generate the native code. You will either compile libgomp into LLVM IR and link it in, or *load* libgomp.so into lli's process. Also, make sure that LLVM was compiled with libffi support. – Anton Korobeynikov Mar 07 '12 at 06:47