研究生: |
劉俊成 Chun-Cheng Liu |
---|---|
論文名稱: |
使用LLVM實作32位元轉64位元之靜態二進制轉譯器 Implementing 32-Bit to 64-Bit Static Binary Translation Using LLVM |
指導教授: |
黃元欣
Yuan-Shin Hwang |
口試委員: |
謝仁偉
Jen-Wei Hsieh 賴祐吉 Yu-Chi Lai |
學位類別: |
碩士 Master |
系所名稱: |
電資學院 - 資訊工程系 Department of Computer Science and Information Engineering |
論文出版年: | 2017 |
畢業學年度: | 106 |
語文別: | 中文 |
論文頁數: | 62 |
中文關鍵詞: | 二進制轉譯器 |
外文關鍵詞: | Binary Translation |
相關次數: | 點閱:136 下載:0 |
分享至: |
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
在過去的研究中,Binary Translator已有不錯的成果,能夠成功的進行二進位碼轉譯至跨平台或相同平台並且擁有不錯的效能,然而在今年蘋果提出在未來新的系統iOS11不在支援32位元的程式,因此32位元的程式無法繼續再新的系統下使用,由此可推論在未來幾年後舊有的32位元平台程式都可能會漸漸陸續淘汰。
在本篇論文中,我們實作32位元轉64位元之LLVM靜態轉譯器,我們將二進位碼執行檔透過靜態轉譯器回到LLVM中間表示碼,並將32位元的指令進行分析與轉換到64位元平台上,目的是為了讓32位元的舊平台環境透過二進位碼轉譯後可以轉換到64位元的新平台上,並使用新的指令以及更多的暫存器數量來提高程式的效率。最後透過LLVM內建強大的最佳化來改善程式執行效能,以及LLVM後端所擁有的程式碼產生器來編譯出目標平台的執行檔。
In the past research, Binary Translator has had good results, able to successfully binary translation into cross-platform or the same platform and has good performance, but this year Apple made in the future the new system iOS11 is not supporting 32-bit Of the program, so 32-bit program can’t continue to use the new system, which can be inferred in the next few years after the old 32-bit platform program may gradually eliminated.
In this paper, we implement the 32-bit to 64-bit LLVM static translator, we will binary code executable file through the static translator back to the LLVM intermediate representation code, and 32-bit instruction to analyze and Converted to a 64-bit platform for the purpose of allowing the 32-bit legacy platform environment to be translated to a 64-bit new platform via binary code and using new instructions and more registers Improve the efficiency of the program. Finally, through LLVM built a powerful optimization to improve program execution performance, and LLVM backend owned by the code generator to compile the target platform executable file.
[1] Linux kernel profiling with perf.
https://perf.wiki.kernel.org/index.php/Tutorial
[2] C. Lattner and V. Adve, “LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation,” in Proceedings of the international symposium on Code generation and optimization: feedback-directed and runtime optimization, ser. CGO ’04. Washington, DC,USA: IEEE Computer Society, 2004, pp. 75.
[3] HQEMU: a multi-threaded and retargetable dynamic binary translator on multicores CGO '12 Proceedings of the Tenth International Symposium on Code Generation and OptimizationPages 104-113.San Jose, California — March 31 - April 04, 2012
[4] GCC. The GNU compiler collection.http://gcc.gnu.org/
[5] Edil S. T. Fernandes, Anna Dolejsi Santos, and Claudio L.de Amorim. Conditional execution: An approach for eliminatingthe basic block barriers. Microprocessing and Microprogrammin,40:689–692, 1994.
[6] Chunho Lee, Miodrag Potkonjakand William H.Mangione-Smith MediaBeinch: A Tool for Evaluating and Synthesizing Multimedia and Communications Systems. In Proceeding of MICRO 30 Proceedings of the 30th annual ACM/IEEE international symposium on MicroarchitecturePages 330-335
[7] C. Lattner and V. Adve.LLVM Language Reference Manual.
http://llvm.cs.uiuc.edu/docs/LangRef.html.
[8] “CLANG,” http://clang.llvm.org.
[9] G. J. Chaitin, et. al., Register allocationvia coloring, In Computer Languages, Vol. 6, pages47-57, Jan. 1981
[10] P. Briggs, K. D. Cooper, and L. Torczon, Improvements to graph Coloring register allocation, In ACM Transactions on Programming Languages and Systems, Vol. 16, No. 3, pages 428-455, May 1994.
[11] Sebastian Hack, Daniel Grund, and Gerhard Goos. Register allocation for programs in SSA-form. In CC'06 Proceedings of the 15th international conference on Compiler Construction, pages 247–262. Springer, 2006.
[12] F. Chow and J. Hennessy. ThePriority-based Coloring Approach to RegisterAllocation, InACM Transactions on Programming Languages and Systems, Vol. 12, No. 4, 1990, pages501-536
[13] Wei-Che Hsu and Yuan-Shin Hwang,Floating Accumulator Architecture, Advanced Science and Technology Letters, Vol. 123(CST 2016), pages 157-162
[14] Exploiting Longer SIMD Lanes in Dynamic Binary Translation.Addison-Wesley Professional, 2nd edition, 2001.Parallel and Distributed Systems (ICPADS), 2016 IEEE 22nd International Conference on Wuhan, China, 13-16 Dec. 2016
[15] Xiaotong Zhuang and Santosh Pande.Differential registerallocation. In Proceedings of the 2005 ACM SIGPLAN conferenceon Programming language design and implementation(PLDI’05), pages 168–179, 2005.
[16] Christopher Lupo, Kent D. Wilken. Post Register Allocation Spill Code Optimization.In: Proceedings of the international symposium on code generation and optimization, CGO ’06. IEEE, New York, page 245–255, 2006
[17] Case Study on LLVM as suitable intermediate language for binary analysis. Florian Markl, Technische Universit at Munchen
[18] David Ryan Koes , Seth Copen Goldstein, Register allocation deconstructed, Proceedings of th 12th International Workshop on Software and Compilers for Embedded Systems, April 23-24, 2009, Nice, France
[19] C. Cifuentes and V. M. Malhotra, “Binary Translation: Static, Dynamic,Retargetable?” in Proceedings of the 1996 International Conference on Software Maintenance, ser. ICSM ’96. Washington, DC, USA: IEEE Computer Society, 1996.
[20] C. Cifuentes and M. V. Emmerik, “UQBT: Adaptable Binary Translation at Low Cost,” Computer, vol. 33, pp. 60–66, March 2000.
[21] V. Adve, C. Lattner, M. Brukman, A. Shukla, and B. Gaeke. LLVA:A Low-level Virtual Instruction Set Architecture. In 36th Int’l Symp.on Microarchitecture, pages 205–216, San Diego, CA, Dec 2003.
[22] Niranjan Hasabnis and R. Sekar, Automatic Generation of Assembly to IR Translators Using Compilers,8th Workshop on Architectural and Microarchitectural Support for Binary Translation (AMAS-BT) 7 February, 2015
[23] Apple will disallow 32-bit apps from running on iOS 11
http://appleinsider.com/articles/17/09/19/how-to-find-the-32-bit-apps-on-your-iphone-or-ipad-that-wont-work-in-ios-11-at-all
[24] Life of an instruction in LLVM
[25] Getting Started with LLVM Core Libraries
[26] How to: Implementing LLVM Integrated Assembler ,Embecosm, http://www.embecosm.com/appnotes/ean10/ean10-howto-llvmas-1.0.html
[27] LLVM Cookbook
[28] LLVM Essentials
[29] Processor register, https://en.wikipedia.org/wiki/Processor_register
[30] Binary Ninja, https://binary.ninja/
[31] MiBench: A free, commercially representative embedded benchmark suite, http://vhosts.eecs.umich.edu/mibench/Publications/MiBench.pdf
[32] MiBench, http://vhosts.eecs.umich.edu/mibench/
[33] The LLVM Compiler Infrastructure Project,https://llvm.org/
[34] MC-sema, https://github.com/trailofbits/mcsema
[35] x86 to LLVM bitcode translation framework,
https://github.com/trailofbits/mcsema/tree/getcfg_binja