elfabidemangler

How to interpret @abc(01) in dynamic symbol name of an .so ELF formatted file?


I have two very similar .so files. Using readelf --syms --wide on them I receive...

... for the first:

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)

... for the second:

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)

What does the (18) and (21) mean, respectively?


Solution

  • What does the (18) and (21) mean, respectively?

    It's the value of .vd_version from corresponding version definition (ElfXX_Verdef in elf.h). For example:

    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
    

    Note that GLIBC_2.2.5 has Version: 3 and GLIBC_2.17 has Version: 5.