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>
On 4 November 2013 23:45, James Lyon <jameslyon0 at gmail.com> wrote:> 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. >Ha, yes, I always get confused. You should communicate with Anton (cc'd), as he was trying to do exactly that a few days ago. I'm also copying the LLVMLinux list, since this is the second thread on the subject in a short time, there might be some trend to make it work and add a buildbot or something like that. I think that, on the Android front, it would be really nice to have Clang/LLVM working well, especially on the JIT front, so that we could have a more generic JIT experience, rather than just Renderscript. We should think about that when creating AOSP images in the future. cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131105/f4e48837/attachment.html>
Is it possible to try your program on a non-Android Linux? It might make debugging a bit less painful. If you haven't updated to the trunk code recently, it's possible that calling finalizeObject more than once would cause a crash. The changes that introduced multiple module support should have fixed that issue. It might be useful to set breakpoints in the memory manager you are using. During finalizeObject you are likely to see calls to finalizeMemory, getSymbolAddress, registerEHFrames and notifyObjectLoaded. I think registerEHFrames is the most likely source of the problem, particularly given that the debugger is also crashing. If that's the problem, you could probably get a little further (for experimental purposes at least) by just having the memory manager do nothing in response to that call. -Andy From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of James Lyon Sent: Monday, November 04, 2013 11:46 PM To: Renato Golin Cc: LLVM Dev Subject: Re: [LLVMdev] Android build patch 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/db45af6a/attachment.html>
This is getting a bit off-topic, but since Renato brought up RenderScript, I wonder if the Android libbcc interface wouldn't be a cleaner way to approach this problem. It provides more or less the same functionality as MCJIT and in almost the same way. -Andy From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Renato Golin Sent: Tuesday, November 05, 2013 12:24 AM To: James Lyon; Anton Smirnov Cc: Compiling the Linux Kernel with Clang/LLVM; LLVM Dev Subject: Re: [LLVMdev] Android build patch On 4 November 2013 23:45, James Lyon <jameslyon0 at gmail.com<mailto:jameslyon0 at gmail.com>> wrote: 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. Ha, yes, I always get confused. You should communicate with Anton (cc'd), as he was trying to do exactly that a few days ago. I'm also copying the LLVMLinux list, since this is the second thread on the subject in a short time, there might be some trend to make it work and add a buildbot or something like that. I think that, on the Android front, it would be really nice to have Clang/LLVM working well, especially on the JIT front, so that we could have a more generic JIT experience, rather than just Renderscript. We should think about that when creating AOSP images in the future. cheers, --renato -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131105/12a7bc15/attachment.html>
I don't have another hardware ARM system, but I got it working under a qemu ARM system before trying Android and there are no issues there. I'm only putting one module in the JIT, so that shouldn't be the issue; thanks for the registerEHFrame suggestion though. I won't get time to try it until the weekend though. On 5 Nov 2013 19:09, "Kaylor, Andrew" <andrew.kaylor at intel.com> wrote:> Is it possible to try your program on a non-Android Linux? It might > make debugging a bit less painful. > > > > If you haven’t updated to the trunk code recently, it’s possible that > calling finalizeObject more than once would cause a crash. The changes > that introduced multiple module support should have fixed that issue. > > > > It might be useful to set breakpoints in the memory manager you are > using. During finalizeObject you are likely to see calls to > finalizeMemory, getSymbolAddress, registerEHFrames and notifyObjectLoaded. > I think registerEHFrames is the most likely source of the problem, > particularly given that the debugger is also crashing. If that’s the > problem, you could probably get a little further (for experimental purposes > at least) by just having the memory manager do nothing in response to that > call. > > > > -Andy > > > > *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On > Behalf Of *James Lyon > *Sent:* Monday, November 04, 2013 11:46 PM > *To:* Renato Golin > *Cc:* LLVM Dev > *Subject:* Re: [LLVMdev] Android build patch > > > > 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> 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/5c0e3c7c/attachment.html>