[LLVMdev] MC JIT on ARM can't generate valid code for external functions call

Kaylor, Andrew andrew.kaylor at intel.com
Tue Mar 13 15:24:55 PDT 2012


There is a patch in progress (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120220/137666.html -- I think it's still just in progress) which refactors the MCJIT dynamic loading and adds some new features.  I believe that support for external functions on ARM is one of the features that was added.

-Andy

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Shamil Kurmangaleev
Sent: Tuesday, March 13, 2012 6:28 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] MC JIT on ARM can't generate valid code for external functions call

Hello.

We found the following problem with MC JIT, on ARM   it can't generate
valid code for  instruction "bl <external_function>" like:

bl printf

Because the ELF file in memory generated by MC JIT does not have the .plt section, but we need to have the following code to be emitted in it:

.plt:00008290                 STR             LR, [SP,#-4]!
.plt:00008294                 LDR             LR, =_GLOBAL_OFFSET_TABLE_
; PIC mode
.plt:00008298                 NOP
.plt:0000829C                 LDR             PC, [LR,#8]!

Also GOT section doesn't exists.

To fix this we need to generate the valid entries in GOT and PLT sections

We propose adding these sections and generating a thunk, same as in the usual compilation pipeline.

 What is the best way to fix these issues?


---
Kurmangaleev Shamil,

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list