[llvm-dev] Help with "function could not be resolved" error

Revital1 Eres via llvm-dev llvm-dev at lists.llvm.org
Sat Nov 14 23:41:58 PST 2015


Hello,

I am trying to run toy program within the JIT as it is done in 
Kaleidoscope examples
and can be seen in the following code snippet.

M = parseInputIR(InputIR);; //the IR of the toy program
auto H = J.addModule(std::move(M));
auto ExprSymbol = J.findUnmangledSymbolIn(H,"main");
double (*FP)(int) = (double (*)(int))(intptr_t)ExprSymbol.getAddress();
std::cerr << "Evaluated to " << FP(8) << "\n"; //run the toy program
 
The problem is that I keep getting "Program used external function 'atoi' 
which could not be resolved"
error when running the program because the toy program contains a call to 
atoi. 
Looking at possible solutions on-line I've tried setting LD_PRELOAD to 
libc
via putenv  and using -rdynamic when linking the Kaleidoscope program but 
that did not solve the error.

BTW, the ldd shows that the program is linked properly with libc which 
contains atoi.

ldd ../clang/bin/Kaleidoscope-Orc-fully_lazy_with_recompile_try
        linux-vdso.so.1 =>  (0x00007fff44b0f000)
        /lib64/libc.so.6 (0x0000003f9aa00000)
        ...

Another option I've read about is to link the toy program statically with 
the bc version of libc using llvm-link
but before trying that I wonder if I can call libc function dynamically.

I appreciate any help with that.

Thanks,
Revital



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151115/39d6aefb/attachment.html>


More information about the llvm-dev mailing list