使用 QEMU 在 x86_64 Ubuntu 上模擬 AARCH64 二進制呼叫 libgps 會給出“錯誤重定位:找不到符號”錯誤
這與此處和此處發布的問題類似。我想對一個名為gpslogger的二進製文件進行逆向工程,但在使用 GDB 調試它之前,我希望使用 QEMU (qemu-aarch64) 簡單地模擬它,因為當我執行時
file gpslogger
我得到gpslogger: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, not stripped
. 我首先下載確切的解釋器文件並將其粘貼到我的 Ubuntu 16.04 x86_64/lib
文件夾中,然後出現其他錯誤,要求其他.so
文件,例如libgps.so
..so
然後我為 AARCH64 架構下載這些文件並將它們粘貼到/lib
我的 Ubuntu 的文件夾中。一旦所有.so
錯誤,即no such file or directory
消失,我就剩下Error relocating /lib/libgps.so: __strdup: symbol not found Error relocating /lib/libgps.so: __fdelt_chk: symbol not found Error relocating /lib/libgps.so: __fprintf_chk: symbol not found Error relocating /lib/libgps.so: __snprintf_chk: symbol not found Error relocating /lib/libgps.so: __isnan: symbol not found Error relocating /lib/libgps.so: __syslog_chk: symbol not found Error relocating /lib/libgps.so: __vsnprintf_chk: symbol not found Error relocating /lib/libdbus-1.so.3: __snprintf_chk: symbol not found Error relocating /lib/libdbus-1.so.3: __vsnprintf_chk: symbol not found Error relocating /lib/libdbus-1.so.3: __strncpy_chk: symbol not found Error relocating /lib/libdbus-1.so.3: __vfprintf_chk: symbol not found Error relocating /lib/libdbus-1.so.3: __fprintf_chk: symbol not found Error relocating /lib/libdbus-1.so.3: __vsprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: __sprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: reallocarray: symbol not found Error relocating /lib/libsystemd.so.0: __register_atfork: symbol not found Error relocating /lib/libsystemd.so.0: __memcpy_chk: symbol not found Error relocating /lib/libsystemd.so.0: __snprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: __vsnprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: __strncpy_chk: symbol not found Error relocating /lib/libsystemd.so.0: __vasprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: __open64_2: symbol not found Error relocating /lib/libsystemd.so.0: __asprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: __fprintf_chk: symbol not found Error relocating /lib/libsystemd.so.0: __ppoll_chk: symbol not found Error relocating /lib/libsystemd.so.0: fcntl64: symbol not found Error relocating /lib/libsystemd.so.0: __explicit_bzero_chk: symbol not found Error relocating /lib/libsystemd.so.0: parse_printf_format: symbol not found Error relocating /lib/libsystemd.so.0: __openat64_2: symbol not found Error relocating /lib/libgcrypt.so.20: __memcpy_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __snprintf_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __fdelt_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __vfprintf_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __memset_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __fprintf_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __read_chk: symbol not found Error relocating /lib/libgcrypt.so.20: __syslog_chk: symbol not found Error relocating /lib/libgpg-error.so.0: __sprintf_chk: symbol not found Error relocating /lib/libgpg-error.so.0: __fdelt_chk: symbol not found Error relocating /lib/libgpg-error.so.0: __vfprintf_chk: symbol not found Error relocating /lib/libgpg-error.so.0: __memset_chk: symbol not found Error relocating /lib/libgpg-error.so.0: __fprintf_chk: symbol not found Error relocating gpslogger: GPSNMEA: symbol not found
除了最後一個重定位錯誤,我相信所有其他功能都應該在
glibc
. 因此,我只是libc-2.32.so
從這裡下載了 AARCH64 架構的文件並將其粘貼到/lib
我的 Ubuntu 的文件夾中。然而,錯誤並沒有消失。如果需要更多資訊,請告訴我。我很感激在這個問題上的任何幫助。編輯:
readelf -d gpslogger | grep 'NEEDED'
返回:
0x0000000000000001 (NEEDED) Shared library: [libgps.so]
0x0000000000000001 (NEEDED) Shared library: [libc.musl-aarch64.so.1]
這是否意味著
libc
來自musl
而不是glibc
?
的輸出中的“interpreter
/lib/ld-musl-aarch64.so.1
”file
表明它gpslogger
是用 musl 建構的。這意味著您不僅需要 musl 動態連結器 (ld-musl-aarch64.so.1
),而且還需要 musl 使用的每個庫的 musl 變體gpslogger
。您列出的缺失符號表明您安裝的庫是為 glibc 建構的。