你打印的是重定位表项。和你需要的函数表项没有任何关系。想获得所有函数,可以打印符号表项中类型为FUNC的表项即可。

解决方案 »

  1.   

    补充说明:plt是调用的外部函数的入口,而rel.plt是这些plt函数的重定位表项。
    你得找个elf的资料仔细研读,否则没法明白。
      

  2.   

    举个例子:下表是某个动态库x.so的符号表项列表,可以通过readelf -s x.so获得,其中类型为FUNC的的符号项目就是函数。
    Symbol table '.dynsym' contains 81 entries:
       Num:    Value  Size Type    Bind   Vis      Ndx Name
         0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
         1: 00000f30     0 SECTION LOCAL  DEFAULT    7 
         2: 00009000     0 SECTION LOCAL  DEFAULT   15 
         3: 00002360    36 FUNC    GLOBAL DEFAULT    7 ___Unwind_ForcedUnwind
         4: 00001fd0   164 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_RaiseExcepti
         5: 00009024     4 OBJECT  GLOBAL DEFAULT   16 starzhu_e
         6: 0000221c     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Save_VFP
         7: 0000233c    36 FUNC    GLOBAL DEFAULT    7 _Unwind_Resume_or_Rethrow
         8: 00001c68     8 FUNC    GLOBAL DEFAULT    7 __aeabi_unwind_cpp_pr0
         9: 000027d4    44 FUNC    GLOBAL DEFAULT    7 _Unwind_GetRegionStart
        10: 0000233c    36 FUNC    GLOBAL DEFAULT    7 ___Unwind_Resume_or_Rethr
        11: 00009038     0 NOTYPE  GLOBAL DEFAULT  ABS _bss_end__
        12: 00000f58   104 FUNC    GLOBAL DEFAULT    7 Java_topstar_test_Topstar
        13: 00002384    36 FUNC    GLOBAL DEFAULT    7 _Unwind_Backtrace
        14: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __cxa_begin_cleanup
        15: 0000901c     4 OBJECT  GLOBAL DEFAULT   15 starzhu_d
        16: 00009018     4 OBJECT  GLOBAL DEFAULT   15 starzhu_c
        17: 00002200    20 FUNC    GLOBAL DEFAULT    7 __restore_core_regs
        18: 0000223c     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Save_VFP_D_1
        19: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __cxa_call_unexpected
        20: 00001fc8     8 FUNC    GLOBAL DEFAULT    7 _Unwind_GetCFA
        21: 00000000     0 FUNC    GLOBAL DEFAULT  UND memcpy
        22: 00001854    68 FUNC    GLOBAL DEFAULT    7 _Unwind_VRS_Set
        23: 00000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_finalize
        24: 000011b8    96 FUNC    GLOBAL DEFAULT    7 mymul
        25: 00008e98     0 NOTYPE  GLOBAL DEFAULT   12 __FINI_ARRAY__
        26: 00009024     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start__
        27: 00002140   192 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Backtrace
        28: 0000222c     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Save_VFP_D
        29: 00001c70   856 FUNC    GLOBAL DEFAULT    7 _Unwind_VRS_Pop
        30: 00001c58     8 FUNC    WEAK   DEFAULT    7 __aeabi_unwind_cpp_pr2
        31: 00002384    36 FUNC    GLOBAL DEFAULT    7 ___Unwind_Backtrace
        32: 000022f4    36 FUNC    GLOBAL DEFAULT    7 ___Unwind_RaiseException
        33: 00000000     0 FUNC    GLOBAL DEFAULT  UND abort
        34: 00002318    36 FUNC    GLOBAL DEFAULT    7 ___Unwind_Resume
        35: 00002244     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Restore_WMMX
        36: 00001218   256 FUNC    GLOBAL DEFAULT    7 mydiv
        37: 00000fc0   120 FUNC    GLOBAL DEFAULT    7 Java_topstar_test_Topstar
        38: 00002214     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Restore_VFP
        39: 00001318     0 FUNC    GLOBAL DEFAULT    7 __aeabi_idiv
        40: 00002318    36 FUNC    GLOBAL DEFAULT    7 _Unwind_Resume
        41: 00002120    32 FUNC    GLOBAL DEFAULT    7 _Unwind_DeleteException
        42: 0000211c     4 FUNC    GLOBAL DEFAULT    7 _Unwind_Complete
        43: 00009038     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_end__
        44: 00009028    15 OBJECT  GLOBAL DEFAULT   16 starzhu_g
        45: 00008e90     0 NOTYPE  GLOBAL DEFAULT   11 __INIT_ARRAY__
        46: 00002400   916 FUNC    GLOBAL DEFAULT    7 __gnu_unwind_execute
        47: 00002224     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Restore_VFP_
        48: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __cxa_type_match
        49: 00002090   108 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Resume
        50: 00000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_atexit
        51: 00002234     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Restore_VFP_
        52: 000022f4    36 FUNC    GLOBAL DEFAULT    7 _Unwind_RaiseException
        53: 00001414    16 FUNC    WEAK   DEFAULT    7 __aeabi_ldiv0
        54: 00009024     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
        55: 00009038     0 NOTYPE  GLOBAL DEFAULT  ABS __end__
        56: 00001318   220 FUNC    GLOBAL DEFAULT    7 __divsi3
        57: 00002074    28 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_ForcedUnwind
        58: 000020fc    32 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Resume_or_Re
        59: 00000000     0 FUNC    WEAK   DEFAULT  UND __gnu_Unwind_Find_exidx
        60: 00002200    20 FUNC    GLOBAL DEFAULT    7 restore_core_regs
        61: 000022e0     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Save_WMMXC
        62: 00009014     4 OBJECT  GLOBAL DEFAULT   15 starzhu_b
        63: 00002840     8 FUNC    GLOBAL DEFAULT    7 _Unwind_GetTextRelBase
        64: 00001038   336 FUNC    GLOBAL DEFAULT    7 Java_topstar_test_Topstar
        65: 00002800    56 FUNC    GLOBAL DEFAULT    7 _Unwind_GetLanguageSpecif
        66: 000017e8    68 FUNC    GLOBAL DEFAULT    7 _Unwind_VRS_Get
        67: 000022cc     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Restore_WMMX
        68: 00002794    64 FUNC    GLOBAL DEFAULT    7 __gnu_unwind_frame
        69: 00002360    36 FUNC    GLOBAL DEFAULT    7 _Unwind_ForcedUnwind
        70: 00009024     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
        71: 00009038     0 NOTYPE  GLOBAL DEFAULT  ABS _end
        72: 00001188    48 FUNC    GLOBAL DEFAULT    7 myadd
        73: 00002288     0 FUNC    GLOBAL DEFAULT    7 __gnu_Unwind_Save_WMMXD
        74: 00001414    16 FUNC    WEAK   DEFAULT    7 __aeabi_idiv0
        75: 00001c60     8 FUNC    WEAK   DEFAULT    7 __aeabi_unwind_cpp_pr1
        76: 00009020     4 OBJECT  GLOBAL DEFAULT   15 starzhu_f
        77: 00009010     4 OBJECT  GLOBAL DEFAULT   15 starzhu_a
        78: 00002838     8 FUNC    GLOBAL DEFAULT    7 _Unwind_GetDataRelBase
        79: 000013f4    32 FUNC    GLOBAL DEFAULT    7 __aeabi_idivmod
        80: 00000000     0 FUNC    GLOBAL DEFAULT  UND raise
      

  3.   

    楼主,请问Soinfo是依赖在什么库下的?能否分享一下?