8
我已經建立了使用LSB SDK測試程序ELF(注意,我的問題是不特定於LSB):我怎樣才能找到不符合ELF的依賴關係?
$ /opt/lsb/bin/lsbcc tst.c
$ ls -l a.out
-rwxr-xr-x 1 math math 10791 2009-10-13 20:13 a.out
$ file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped
但我無法啓動它(是的,我向你保證文件是在目錄 ...):
$ ./a.out
bash: ./a.out: No such file or directory
$ uname -a
Linux math 2.6.28-15-generiC#52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009 x86_64 GNU/Linux
我覺得這是一個ELF依賴未履行,但我不知道如何找到它。是否有類似於ldd的工具可用於找到缺失的鏈接?
我不認爲這是關係到2.6.15/2.6.28-15區別,因爲LSB編譯器工作:
$ file /opt/lsb/bin/lsbcc
/opt/lsb/bin/lsbcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped
以防萬一,這裏是一個ELF的動態部分.out:
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000c (INIT) 0x400428
0x000000000000000d (FINI) 0x400638
0x0000000000000004 (HASH) 0x400278
0x0000000000000005 (STRTAB) 0x400350
0x0000000000000006 (SYMTAB) 0x4002a8
0x000000000000000a (STRSZ) 121 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000015 (DEBUG) 0x0
0x0000000000000003 (PLTGOT) 0x600fe8
0x0000000000000002 (PLTRELSZ) 24 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x400410
0x0000000000000007 (RELA) 0x4003f8
0x0000000000000008 (RELASZ) 24 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x4003d8
0x000000006fffffff (VERNEEDNUM) 1
0x000000006ffffff0 (VERSYM) 0x4003ca
0x0000000000000000 (NULL) 0x0
就是這樣,我沒有系統上的LSB解釋器(/lib64/ld-lsb-x86-64.so.3)。事實上,我不知道我需要安裝一個LSB特定解釋器...... 有趣的是,LSB SDK中的二進制文件不符合LSB標準。 – math 2009-10-13 21:17:39