透過您的圖書館登入
IP:18.224.29.201
  • 學位論文

一個在二元轉譯中連結原生函式庫且可重定目標之方法

A Retargetable Approach for Linking Native Shared Libraries in Binary Translation

指導教授 : 楊武

摘要


二元轉譯是一種對移植應用程式到不同指令集常用的手段,動態連結共享函式庫也是經常被使用在以作業系統為主的系統上,但是在二元轉譯中,如何去處理動態連結的二元檔,尚未被廣泛討論。在二元轉譯系統中,有兩種方法可用來連結轉譯過後的可執行檔和其共享函式庫: (1) 我們可以使用轉譯過後的原始共享函式庫 (在原始平台的共享函式庫,稱作已轉譯共享函式庫) (2) 在我們的二元轉譯系統中,我們嘗試去連結目標平台的已經存在的共享函式庫 (稱作原生共享函式庫)。 連結原生共享函式庫的好處是可以增進執行效率和節省系統硬碟空間。然而,因為已轉譯可執行檔和原生共享函式庫有不同的ABI,如何去處理它們之間的互動是一個很艱鉅的挑戰。 我們提出一個在二元轉譯中連結原生函式庫且可重定目標之方法,並實作在一個靜態二元轉譯系統LLBT中,它可轉譯ARM二元碼到LLVM中介碼,然後利用LLVM的後端產生已轉譯二元碼,這是一個無關目標平台的方法。 在我們的實驗中,已轉譯的SPEC2006程式並連結原生共享函式庫在i7的機器上跑得比其換成原本連結已轉譯共享函式庫還快,連結原生共享函式庫可以達到平均1.18的加速比。

並列摘要


Binary translation is commonly used to migrate applications from one ISA to another and dynamic linking of shared libraries is widely used in OS-based systems. But how to handle dynamically linked binaries in a binary translation system has not been widely discussed. There are two ways in a binary translation system to link a translated executable with shared libraries: (1) We may use the shared libraries that are translated from the original shared libraries, which are on the source platform (which are called the translated shared libraries). (2) In our binary translation system, we attempted to link with the target shared libraries, which are compiled for and already on the target platform (which are called the native shared libraries). Advantages of linking with native shared libraries include improving execution efficiency and saving system disk space. However, it is a significant challenge to handle the interactions between the translated executable and the native shared libraries since they may have different abstract binary interfaces (ABIs). We present a retargetable approach for linking translated executables with native shared libraries. We implement it on a static binary translation system, called LLBT, which translates ARM binary to LLVM IR in a target-independent way and then generates the translated binary by the LLVM infrastructure. The generated IR has been available to be retargeted to different architectures, such as MIPS, without modification. In our experiment, the translated programs in the SPEC2006 CINT benchmarks linked with native shared libraries ran faster than the ones linked with translated shared libraries on an i7 machine. Linking with native shared libraries can achieve an average speedup of 1.18.

參考文獻


translation at low cost. Computer, 33(3):60 –66, mar 2000.
[1] GCC, the GNU Compiler Collection.
[6] Standard Performance Evaluation Corporation.
Architecture, October 2009.
[10] Jiunn-Yeu Chen, Wuu Yang, Jack Hung, Charlie Su, and Wei Chung

延伸閱讀