撒拉嘿哟木头 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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。