<font size=2 face="sans-serif">Hello,</font><br><br><font size=2 face="sans-serif">I am trying to run toy program within
the JIT as it is done in Kaleidoscope examples</font><br><font size=2 face="sans-serif">and can be seen in the following code
snippet.</font><br><br><font size=2 face="sans-serif">M = parseInputIR(InputIR);; //the IR
of the toy program</font><br><font size=2 face="sans-serif">auto H = J.addModule(std::move(M));</font><br><font size=2 face="sans-serif">auto ExprSymbol = J.findUnmangledSymbolIn(H,"main");</font><br><font size=2 face="sans-serif">double (*FP)(int) = (double (*)(int))(intptr_t)ExprSymbol.getAddress();</font><br><font size=2 face="sans-serif">std::cerr << "Evaluated to
" << FP(8) << "\n"; //run the toy program</font><br><font size=2 face="sans-serif">           
          </font><br><font size=2 face="sans-serif">The problem is that I keep getting "Program
used external function 'atoi' which could not be resolved"</font><br><font size=2 face="sans-serif">error when running the program because
the toy program contains a call to atoi. </font><br><font size=2 face="sans-serif">Looking at possible solutions on-line
I've tried setting LD_PRELOAD to libc</font><br><font size=2 face="sans-serif">via putenv  and using -rdynamic
when linking the Kaleidoscope program but that did not solve the error.</font><br><br><font size=2 face="sans-serif">BTW, the ldd shows that the program
is linked properly with libc which contains atoi.</font><br><br><font size=2 face="sans-serif">ldd ../clang/bin/Kaleidoscope-Orc-fully_lazy_with_recompile_try</font><br><font size=2 face="sans-serif">        linux-vdso.so.1
=>  (0x00007fff44b0f000)</font><br><font size=2 face="sans-serif">        /lib64/libc.so.6
(0x0000003f9aa00000)</font><br><font size=2 face="sans-serif">        ...</font><br><br><font size=2 face="sans-serif">Another option I've read about is to
link the toy program statically with the bc version of libc using llvm-link</font><br><font size=2 face="sans-serif">but before trying that I wonder if I
can call libc function dynamically.</font><br><br><font size=2 face="sans-serif">I appreciate any help with that.</font><br><br><font size=2 face="sans-serif">Thanks,</font><br><font size=2 face="sans-serif">Revital</font><br><br><BR>