撒拉嘿哟木头 2008-08-29 16:57 采纳率: 100%
浏览 146
已采纳

我如何列出符号在。 那就归档吧

How do list the symbols being exported from a .so file. If possible, I'd also like to know their source (e.g. if they are pulled in from a static library).

I'm using gcc 4.0.2, if that makes a difference

转载于:https://stackoverflow.com/questions/34732/how-do-i-list-the-symbols-in-a-so-file

  • 写回答

10条回答 默认 最新

  • bug^君 2008-08-29 17:21
    关注

    The standard tool for listing symbols is nm, you can use it simply like this:

    nm -g yourLib.so
    

    If you want to see symbols of a C++ library, add the "-C" option which demangle the symbols (it's far more readable demangled).

    nm -gC yourLib.so
    

    If your .so file is in elf format, you have two options:

    Either objdump (-C is also useful for demangling C++):

    $ objdump -TC libz.so
    
    libz.so:     file format elf64-x86-64
    
    DYNAMIC SYMBOL TABLE:
    0000000000002010 l    d  .init  0000000000000000              .init
    0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 free
    0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 __errno_location
    0000000000000000  w   D  *UND*  0000000000000000              _ITM_deregisterTMCloneTable
    

    Or use readelf:

    $ readelf -Ws libz.so
    Symbol table '.dynsym' contains 112 entries:
       Num:    Value          Size Type    Bind   Vis      Ndx Name
         0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND
         1: 0000000000002010     0 SECTION LOCAL  DEFAULT   10
         2: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND free@GLIBC_2.2.5 (14)
         3: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __errno_location@GLIBC_2.2.5 (14)
         4: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTable
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(9条)

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥20 sim800c模块 at指令及平台
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计