How to execute LLVM IR code generated from Python source code using numba

Hello Everyone,

I am trying to generate llvm IR from python and then execute it. I used numba to generate llvm IR. While linking I am getting some undefined references. I am not sure which python packages I need to load to resolve this issue. If someone can help me I would appreciate it. If there is any other way to get llvm IR from python, please let me know.

numba test.py --dump-llvm > test.ll

llvm-as test.ll –o test.bc

llc test.bc -filetype=obj -o test.c.o

clang -pg test.c.o -o test.o

test.ll:(.text+0x631): undefined reference to `numba_gil_ensure’

test.ll:(.text+0x643): undefined reference to `numba_unpickle’

test.ll:(.text+0x64e): undefined reference to `PyObject_Str’

test.ll:(.text+0x659): undefined reference to `PyUnicode_AsUTF8’

test.ll:(.text+0x668): undefined reference to `PySys_WriteStdout’

test.ll:(.text+0x670): undefined reference to `Py_DecRef’

test.ll:(.text+0x678): undefined reference to `Py_DecRef’

test.ll:(.text+0x684): undefined reference to `PySys_WriteStdout’

Regards,

Sangeeta

Any suggestions or pointers?

Hi,

This looks like a question for the numba folks: some of the symbols here as provided by the numba runtime.