<div dir="ltr">What LLVM version are you using?<div><br></div><div>There were some bugs around switching ARM/Thumb mode on ARMv4 fixed in 3.6.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 11, 2015 at 1:20 PM, Frédéric Richez <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I’m tying to run a rust application on armv4 architecture (arm720tdmi).<div>Rust is using llvm to generate native code.</div><div>Some programs are running well on the target but for more complex applications I receive a Illegal instruction :</div><div><p style="color:rgb(34,34,34);font-family:Helvetica,Arial,sans-serif;font-size:14px;line-height:19px">gdb disassembling the core dump file gives :</p><pre style="overflow:auto;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace;font-size:14px;color:rgb(34,34,34);line-height:19px">   0x401e41dc <+0>:     push    {r11, lr}
   0x401e41e0 <+4>:       mov     r11, sp
   0x401e41e4 <+8>:       sub     sp, sp, #8
   0x401e41e8 <+12>:      ldr     r0, [r0]
   0x401e41ec <+16>:      str     r0, [sp, #4]
   0x401e41f0 <+20>:      mov     r0, r1
   0x401e41f4 <+24>:      ldr     r1, [sp, #4]
=> 0x401e41f8 <+28>:   blx     r1
   0x401e41fc <+32>:      and     r0, r0, #1
   0x401e4200 <+36>:      and     r0, r0, #1
   0x401e4204 <+40>:      mov     sp, r11
   0x401e4208 <+44>:      pop     {r11, lr}
   0x401e420c <+48>:      bx      lr</pre><div><span style="color:rgb(34,34,34);font-family:Helvetica,Arial,sans-serif;font-size:14px;line-height:19px;background-color:rgb(255,255,255)">blx instruction is available from ARM architecture v5 and above</span><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px">…</span></font></div></div><div><span style="color:rgb(34,34,34);font-family:Helvetica,Arial,sans-serif;font-size:14px;line-height:19px;background-color:rgb(255,255,255)"><br></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px">After lot of investigations I found where llvm is generating this </span></font></span><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px">instruction :</span></font></div><div><a href="https://github.com/rust-lang/llvm/blob/168f91ce5cbf8933e47f339911f0f46a48714852/lib/Target/ARM/ARMFastISel.cpp#L2395" target="_blank">https://github.com/rust-lang/llvm/blob/168f91ce5cbf8933e47f339911f0f46a48714852/lib/Target/ARM/ARMFastISel.cpp#L2395</a></div><div><span style="color:rgb(34,34,34);font-family:Helvetica,Arial,sans-serif;font-size:14px;line-height:19px;background-color:rgb(255,255,255)">UseReg variable is true causing ARMSelectCallOp function to set a BLX instruction that is not supported on armv4 :-(</span></div><div><span style="color:rgb(34,34,34);font-family:Helvetica,Arial,sans-serif;font-size:14px;line-height:19px;background-color:rgb(255,255,255)"><br></span></div><div><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px;background-color:rgb(255,255,255)">Could you help me to solve this ? </span></font></div><div><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px;background-color:rgb(255,255,255)"><br></span></font></div><div><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px;background-color:rgb(255,255,255)">Many thanks</span></font></div><span class="HOEnZb"><font color="#888888"><div><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px;background-color:rgb(255,255,255)"><br></span></font></div><div><font color="#222222" face="Helvetica, Arial, sans-serif"><span style="font-size:14px;line-height:19px;background-color:rgb(255,255,255)">Frédéric.</span></font></div><div><br></div></font></span></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>