我正试图用patchelf
修补MuJoCo二进制文件.
我跑了patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) ./bin/basic
. run patchelf --print-interpreter bin/basic
给我/nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/ld-linux-x86-64.so.2
分.
现在,如果我运行./bin/basic
,我会得到输出:bash: ./bin/basic: cannot execute binary file: Exec format error
跑ldd ./bin/basic
分让我得到not a dynamic executable
分,我觉得这很奇怪.
file ./bin/basic
%的yield 率:
./bin/basic: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/ld-linux-x86-64.so.2, for GNU/Linux 3.7.0, not stripped
我觉得这没问题.我认为头球可能有问题,所以我try 了readelf -h bin/basic
次,这给了我:
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: AArch64
Version: 0x1
Entry point address: 0x232f70
Start of program headers: 64 (bytes into file)
Start of section headers: 293584 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 12
Size of section headers: 64 (bytes)
Number of section headers: 28
Section header string table index: 26
这就是我到目前为止得到的:
-
file
和readelf -h
都认为它是一个动态链接的可执行文件 - 试图运行它失败了
-
ldd
认为它不是一个动态链接的可执行文件
有人知道这里的问题是什么吗?
我怀疑elf文件中有一些无效的东西,file
和readelf
没有注意到.
有没有一个工具可以用来用elf文件搜索此类问题?