如何在.so ELF格式的文件的动态符号名称中解释@abc(01)?

时间:2019-01-18 08:24:47

标签: elf abi demangler

我有两个非常相似的.so文件。我在他们身上使用readelf --syms --wide ...

...第一个:

631: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_guard_acquire@CXXABI_1.3 (18)
666: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_pure_virtual@CXXABI_1.3 (18)

...第二次:

671: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_guard_acquire@CXXABI_1.3 (21)    
706: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_pure_virtual@CXXABI_1.3 (21)

(18)和(21)分别是什么意思?

1 个答案:

答案 0 :(得分:1)

  

(18)和(21)分别是什么意思?

它是来自相应版本定义(.vd_version中的ElfXX_Verdef)中的elf.h的值。例如:

readelf -Ws /bin/date | egrep ' (setenv|clock_gettime)'
    14: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND clock_gettime@GLIBC_2.17 (5)
    15: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND setenv@GLIBC_2.2.5 (3)

readelf -V /bin/date
...
Version needs section '.gnu.version_r' contains 1 entry:
 Addr: 0x0000000000000fd8  Offset: 0x000fd8  Link: 6 (.dynstr)
  000000: Version: 1  File: libc.so.6  Cnt: 6
  0x0010:   Name: GLIBC_2.14  Flags: none  Version: 7
  0x0020:   Name: GLIBC_2.4  Flags: none  Version: 6
  0x0030:   Name: GLIBC_2.17  Flags: none  Version: 5
  0x0040:   Name: GLIBC_2.3.4  Flags: none  Version: 4
  0x0050:   Name: GLIBC_2.2.5  Flags: none  Version: 3
  0x0060:   Name: GLIBC_2.3  Flags: none  Version: 2

请注意,GLIBC_2.2.5Version: 3,而GLIBC_2.17Version: 5