A Retargetable Static Binary Translator for the ARM Architecture

Machines designed with new but incompatible Instruction Set Architecture (ISA) may lack proper applications. Binary translation can address this incompatibility by migrating applications from one legacy ISA to a new one, although binary translation has problems such as code discovery for variable-length ISA and code location issues for handling indirect branches. Dynamic Binary Translation (DBT) has been widely adopted for migrating applications since it avoids those problems. Static Binary Translation (SBT) is a less general solution and has not been actively researched. However, SBT performs more aggressive optimizations, which could yield more compact code and better code quality. Applications translated by SBT can consume less memory, processor cycles, and power than DBT and can be started more quickly. These advantages are even more critical for embedded systems than for general systems. In this article, we designed and implemented a new SBT tool, called LLBT, which translates ARM instructions into LLVM IRs and then retargets the LLVM IRs to various ISAs, including ×86, ×86--64, ARM, and MIPS. LLBT leverages two important functionalities from LLVM: comprehensive optimizations and retargetability. More importantly, LLBT solves the code discovery problem for ARM/Thumb binaries without resorting to interpretation. LLBT also effectively reduced the size of the address mapping table, making SBT a viable solution for embedded systems. Our experiments based on the EEMBC benchmark suite show that the LLBT-generated code can run more than 6× and 2.3× faster on average than emulation with QEMU and HQEMU, respectively.

[1]  Alexander Aiken,et al.  Automatic generation of peephole superoptimizers , 2006, ASPLOS XII.

[2]  Jack W. Davidson,et al.  Addressing the challenges of DBT for the ARM architecture , 2009, LCTES '09.

[3]  Yuan-Shin Hwang,et al.  DisIRer: Converting a retargetable compiler into a multiplatform binary translator , 2010, TACO.

[4]  Kevin Skadron,et al.  Low-overhead Software Dynamic Translation , 2001 .

[5]  James E. Smith,et al.  Virtual machines - versatile platforms for systems and processes , 2005 .

[6]  Kristy Andrews,et al.  Migrating a CISC computer family onto RISC via object code translation , 1992, ASPLOS V.

[7]  Norman Ramsey,et al.  Experience in the design, implementation and use of a retargetable static binary translation framework , 2002 .

[8]  K. Ebcioglu,et al.  Daisy: Dynamic Compilation For 10o?40 Architectural Compatibility , 1997, Conference Proceedings. The 24th Annual International Symposium on Computer Architecture.

[9]  Wuu Yang,et al.  An LLVM-based hybrid binary translation system , 2012, 7th IEEE International Symposium on Industrial Embedded Systems (SIES'12).

[10]  Yun Wang,et al.  IA-32 execution layer: a two-phase dynamic translator designed to support IA-32 applications on Itanium/spl reg/-based systems , 2003, Proceedings. 36th Annual IEEE/ACM International Symposium on Microarchitecture, 2003. MICRO-36..

[11]  Richard L. Sites,et al.  Binary translation , 1993, CACM.

[12]  Erik R. Altman,et al.  Welcome to the Opportunities of Binary Translation , 2000, Computer.

[13]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

[14]  Koen De Bosschere,et al.  Automated reduction of the memory footprint of the Linux kernel , 2007, TECS.

[15]  Koen De Bosschere,et al.  Link-time compaction and optimization of ARM executables , 2007, TECS.

[16]  Wuu Yang,et al.  Effective code discovery for ARM/Thumb mixed ISA binaries in a static binary translator , 2013, 2013 International Conference on Compilers, Architecture and Synthesis for Embedded Systems (CASES).

[17]  Apala Guha,et al.  Memory optimization of dynamic binary translators for embedded systems , 2012, TACO.

[18]  Cristina Cifuentes,et al.  Machine-adaptable dynamic binary translation , 2000 .

[19]  Sencun Zhu,et al.  STILL: Exploit Code Detection via Static Taint and Initialization Analyses , 2008, 2008 Annual Computer Security Applications Conference (ACSAC).

[20]  Mary Lou Soffa,et al.  Retargetable and reconfigurable software dynamic translation , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[21]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[22]  Fabrice Bellard,et al.  QEMU, a Fast and Portable Dynamic Translator , 2005, USENIX ATC, FREENIX Track.

[23]  Harish Patil,et al.  Pin: building customized program analysis tools with dynamic instrumentation , 2005, PLDI '05.

[24]  Alexander Aiken,et al.  Binary Translation Using Peephole Superoptimizers , 2008, OSDI.

[25]  Cristina Cifuentes,et al.  Recovery of jump table case statements from binary code , 2001, Sci. Comput. Program..

[26]  Michael Gschwind,et al.  Dynamic and Transparent Binary Translation , 2000, Computer.

[27]  Cristina Cifuentes,et al.  Binary translation: static, dynamic, retargetable? , 1996, 1996 Proceedings of International Conference on Software Maintenance.

[28]  Jack W. Davidson,et al.  Fragment cache management for dynamic binary translators in embedded systems with scratchpad , 2007, CASES '07.

[29]  Derek Bruening,et al.  An infrastructure for adaptive dynamic optimization , 2003, International Symposium on Code Generation and Optimization, 2003. CGO 2003..

[30]  Cristina Cifuentes,et al.  Walkabout: a retargetable dynamic binary translation framework , 2002 .

[31]  Jack W. Davidson,et al.  Reducing pressure in bounded DBT code caches , 2008, CASES '08.

[32]  Dawid Kurzyniec,et al.  Efficient Cooperation between Java and Native Codes – JNI Performance Benchmark , 2001 .

[33]  John Yates,et al.  FX!32 a profile-directed binary translator , 1998, IEEE Micro.

[34]  Wei-Kuan Shih,et al.  A method-based ahead-of-time compiler for Android applications , 2011, 2011 Proceedings of the 14th International Conference on Compilers, Architectures and Synthesis for Embedded Systems (CASES).

[35]  Yun Wang,et al.  IA-32 Execution Layer: a two-phase dynamic translator designed to support IA-32 applications on Itanium-based systems , 2003, MICRO.

[36]  David Seal,et al.  ARM Architecture Reference Manual , 2001 .

[37]  Jae Wook Jeon,et al.  Evaluating performance of Android platform using native C for embedded systems , 2010, ICCAS 2010.

[38]  HsuWei-Chung,et al.  A Retargetable Static Binary Translator for the ARM Architecture , 2014 .

[39]  Wuu Yang,et al.  A Static Binary Translator for Efficient Migration of ARM based Applications , 2008 .

[40]  Bor-Yeh Shen,et al.  Automatic Validation for Static Binary Translation , 2013 .

[41]  Chien-Min Wang,et al.  HQEMU: a multi-threaded and retargetable dynamic binary translator on multicores , 2012, CGO '12.

[42]  Apala Guha,et al.  Reducing Exit Stub Memory Consumption in Code Caches , 2007, HiPEAC.

[43]  Cindy Zheng,et al.  PA-RISC to IA-64: Transparent Execution, No Recompilation , 2000, Computer.

[44]  Mike Van,et al.  UQBT: Adaptable Binary Translation at Low Cost , 2000 .