<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I found out that even calling functions that are defined inside LLVM bitcode doesn't work.<div>So following C code when compiled without any optimizations also crashes with JIT when main function is called (with optimizations function call is optimized away, of course).</div><div><br></div><div>***</div><div>static int fun(int x) { return x + 1; }</div><div>int main()</div><div>{</div><div>  return fun(30);</div><div>}</div><div>***</div><div><br></div><div>Is there some special conditions on ARM I need to check for LLVM call functions correctly?</div><div><br></div><div>--</div><div>Martins Mozeiko</div><div><br></div><div><br><div><br><div>Begin forwarded message:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>From: </b></span><span style="font-family:'Helvetica'; font-size:medium;">Martins Mozeiko <<a href="mailto:49640f8a@gmail.com">49640f8a@gmail.com</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Date: </b></span><span style="font-family:'Helvetica'; font-size:medium;">September 25, 2009 12:04:04 GMT+03:00<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>To: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1);"><b>Subject: </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>JIT on ARM</b><br></span></div><br><div>Hello.<br><br>My goal is to use LLVM with JIT compiler for ARM on Android device.<br><br>Currently I have successfully built and executed LLVM bitcode with interpreter on Android. Speed is not so great, that is why I want to use JIT.<br>I tried building bitcode on windows with llvm-gcc that is provided on llvm home page. Resulting bitcode runs great in interpreter, but it doesn't use JIT. From what I understand from LLVM that it is because of target triple or datalayout. On PC in my case target triple is "i386-mingw32", but LLVM JIT for ARM expects something that starts with "armv" or "thumb". Also datalayout differs a lot. If I understand correctly that is because bitcode actually contains some of platform specific optimizations (like integer endianness), so I can't simply change target triple string and everything will run.<br><br>What I am now doing, is - I am trying to build gcc from gcc-4.2-llvm-2.5 sources with following configure line in cygwin shell:<br><br>../llvm-gcc4.2-2.4.source/configure --enable-languages=c,c++ --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-bootstrap --disable-multilib --disable-nls --target=arm-eabi<br><br>My undertanding is that this will produce llvm-gcc compiler that will output LLVM bitcode with target triple that starts with "arm", so LLVM will use JIT on it.<br><br>Currently I am getting compile problems when running make (see below).<br>Has anyone done something similar and can explain what I am doing wrong, or how should it be done in some other way to get JIT compiler running on ARM?<br><br><br>make[2]: Entering directory `/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc'<br>gcc   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -fno-common   -DHAVE_CONFIG_H -DGENERATOR_FILE  -o build/gengtype.exe \<br>            build/gengtype.o build/gengtype-lex.o build/gengtype-yacc.o build/errors.o ../build-i686-pc-cygwin/libiberty/libiberty.a<br>build/gengtype.o: In function `adjust_field_type':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:763: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:771: undefined reference to `_lexer_line'<br>build/gengtype.o: In function `adjust_field_tree_exp':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:713: undefined reference to `_lexer_line'<br>build/gengtype.o: In function `adjust_field_rtx_def':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:488: undefined reference to `_lexer_line'<br>build/gengtype.o: In function `adjust_field_type':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:785: undefined reference to `_lexer_line'<br>build/gengtype.o:/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:725: more undefined references to `_lexer_line' follow<br>build/gengtype.o: In function `main':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:3070: undefined reference to `_parse_file'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype.c:3070: undefined reference to `_parse_file'<br>build/gengtype-yacc.o: In function `yyparse':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:73: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:75: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:76: undefined reference to `_lexer_toplevel_done'<br>build/gengtype-yacc.o: In function `yyparse':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/gengtype-yacc.c:1873: undefined reference to `_yyerror'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/gengtype-yacc.c:1379: undefined reference to `_yylex'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/gengtype-yacc.c:1877: undefined reference to `_yyerror'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/gengtype-yacc.c:1995: undefined reference to `_yyerror'<br>build/gengtype-yacc.o: In function `yyparse':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:122: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:110: undefined reference to `_lexer_toplevel_done'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:102: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:97: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:92: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:239: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:235: undefined reference to `_lexer_line'<br>build/gengtype-yacc.o:/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:231: more undefined references to `_lexer_line' follow<br>build/gengtype-yacc.o: In function `yyparse':<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:84: undefined reference to `_lexer_toplevel_done'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:203: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:203: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:176: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:176: undefined reference to `_lexer_line'<br>/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:165: undefined reference to `_lexer_line'<br>build/gengtype-yacc.o:/cygdrive/r/android/llvm/llvm-gcc4.2-objects/gcc/../../llvm-gcc4.2-2.4.source/gcc/gengtype-yacc.y:165: more undefined references to `_lexer_line' follow<br>collect2: ld returned 1 exit status<br>make[2]: *** [build/gengtype.exe] Error 1<br><br>--<br>Martins Mozeiko<br><br></div></blockquote></div><br></div></body></html>