I've been trying to get LLVM JIT compilation working on Android for the last few days. The patch I needed to get it to build is attached (nothing major - CMake configuration header typo and avoiding open64 which is missing on Android). Sadly even though it builds I can't get generated code to work - it appears at the moment that the generated code doesn't have execute permissions set for some reason (this is 3.3, not svn). James -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-android.patch Type: text/x-patch Size: 1648 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131031/c776c76a/attachment.bin>
On 30 October 2013 17:08, James Lyon <jameslyon0 at gmail.com> wrote:> Sadly even though it builds I can't get generated code to work - it > appears at the moment that the generated code doesn't have execute > permissions set for some reason (this is 3.3, not svn).Hi, You may have a look at the LLVM Linux builds ( http://llvm.linuxfoundation.org/index.php/Main_Page), it might help you getting Android compiled with LLVM. cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131104/f9bba82d/attachment.html>
The CMake changes look fine to me, landed in r194051! As for the JITMemoryManager.cpp changes, not so sure. Did you try disabling the 'hack' described below instead of patching it? | ||//===----------------------------------------------------------------------===//|| ||// Function stubs that are invoked instead of certain library calls|| ||//|| ||// Force the following functions to be linked in to anything that uses the|| ||// JIT. This is a hack designed to work around the all-too-clever Glibc|| ||// strategy of making these functions work differently when inlined vs. when|| ||// not inlined, and hiding their real definitions in a separate archive file|| ||// that the dynamic linker can't see. For more info, search for|| ||// 'libc_nonshared.a' on Google, or read http://llvm.org/PR274.|| ||#if defined(__linux__)| ^ ie try making this defined(__linux__) && !defined(__BIONIC__) Alp. On 31/10/2013 00:08, James Lyon wrote:> I've been trying to get LLVM JIT compilation working on Android for > the last few days. The patch I needed to get it to build is attached > (nothing major - CMake configuration header typo and avoiding open64 > which is missing on Android). > > Sadly even though it builds I can't get generated code to work - it > appears at the moment that the generated code doesn't have execute > permissions set for some reason (this is 3.3, not svn). > > James > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-- http://www.nuanti.com the browser experts -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131105/76ab1f81/attachment.html>
I'm trying to build LLVM on Android rather than the other way around! Really just to see if it can be done. I worked out the first problem (my code was written for the old JIT and I'd missed something in updating to the MCJIT to make it work on ARM). It still doesn't work, but at this point I have no idea why and it'll be a while before I get to look at it again: the Android debug tools simply crash and give no output whatsoever, so all I know is that the test app exits somewhere inside MCJIT::finalizeObject. On 05/11/13 07:13, Renato Golin wrote:> On 30 October 2013 17:08, James Lyon <jameslyon0 at gmail.com > <mailto:jameslyon0 at gmail.com>> wrote: > > Sadly even though it builds I can't get generated code to work - > it appears at the moment that the generated code doesn't have > execute permissions set for some reason (this is 3.3, not svn). > > > Hi, > > You may have a look at the LLVM Linux builds > (http://llvm.linuxfoundation.org/index.php/Main_Page), it might help > you getting Android compiled with LLVM. > > cheers, > --renato-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131105/d0fb813f/attachment.html>
I suppose I was just doing the "smallest" thing. Disabling the hack entirely also allows it to build and is probably the correct thing to do. I'm not that knowledgeable about glibc vs. Bionic differences so the thing to do would be to test whether those functions work without the "hack" on Android. Unfortunately at the moment I can't get my Android JIT test program to actually run; it crashes somewhere in LLVM without any useful output (the debugger also crashes), so that one's going to take some time to figure out. On 05/11/13 07:33, Alp Toker wrote:> The CMake changes look fine to me, landed in r194051! > > As for the JITMemoryManager.cpp changes, not so sure. Did you try > disabling the 'hack' described below instead of patching it? > > > | > ||//===----------------------------------------------------------------------===//|| > ||// Function stubs that are invoked instead of certain library calls|| > ||//|| > ||// Force the following functions to be linked in to anything that > uses the|| > ||// JIT. This is a hack designed to work around the all-too-clever > Glibc|| > ||// strategy of making these functions work differently when inlined > vs. when|| > ||// not inlined, and hiding their real definitions in a separate > archive file|| > ||// that the dynamic linker can't see. For more info, search for|| > ||// 'libc_nonshared.a' on Google, or read http://llvm.org/PR274.|| > ||#if defined(__linux__)| > > ^ ie try making this defined(__linux__) && !defined(__BIONIC__) > > Alp. > > > On 31/10/2013 00:08, James Lyon wrote: >> I've been trying to get LLVM JIT compilation working on Android for >> the last few days. The patch I needed to get it to build is attached >> (nothing major - CMake configuration header typo and avoiding open64 >> which is missing on Android). >> >> Sadly even though it builds I can't get generated code to work - it >> appears at the moment that the generated code doesn't have execute >> permissions set for some reason (this is 3.3, not svn). >> >> James >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > -- > http://www.nuanti.com > the browser experts-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131105/d3f3fabc/attachment.html>