<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I’m tying to run a rust application on armv4 architecture (arm720tdmi).<div class="">Rust is using llvm to generate native code.</div><div class="">Some programs are running well on the target but for more complex applications I receive a Illegal instruction :</div><div class=""><p style="color: rgb(34, 34, 34); font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19px;" class="">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;" class=""> 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 class=""><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);" class="">blx instruction is available from ARM architecture v5 and above</span><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px;" class="">…</span></font></div></div><div class=""><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);" class=""><br class=""></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px;" class="">After lot of investigations I found where llvm is generating this </span></font></span><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px;" class="">instruction :</span></font></div><div class=""><a href="https://github.com/rust-lang/llvm/blob/168f91ce5cbf8933e47f339911f0f46a48714852/lib/Target/ARM/ARMFastISel.cpp#L2395" class="">https://github.com/rust-lang/llvm/blob/168f91ce5cbf8933e47f339911f0f46a48714852/lib/Target/ARM/ARMFastISel.cpp#L2395</a></div><div class=""><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);" class="">UseReg variable is true causing ARMSelectCallOp function to set a BLX instruction that is not supported on armv4 :-(</span></div><div class=""><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);" class=""><br class=""></span></div><div class=""><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px; background-color: rgb(255, 255, 255);" class="">Could you help me to solve this ? </span></font></div><div class=""><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px; background-color: rgb(255, 255, 255);" class="">Many thanks</span></font></div><div class=""><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px; background-color: rgb(255, 255, 255);" class=""><br class=""></span></font></div><div class=""><font color="#222222" face="Helvetica, Arial, sans-serif" class=""><span style="font-size: 14px; line-height: 19px; background-color: rgb(255, 255, 255);" class="">Frédéric.</span></font></div><div class=""><br class=""></div></body></html>