linux命令之查看动态库符号-nm
生活随笔
收集整理的這篇文章主要介紹了
linux命令之查看动态库符号-nm
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在調用動態庫的時候,經常出現由于動態庫接口修改或者版本不匹配導致調用動態庫找不到函數接口符號的情況。
原因可能有如下幾種:
1.由于c++動態庫編譯沒有加extern c導致函數編譯時加了c++的前綴的;
2.系統中有多個庫,程序加載了其他路徑的庫;
3.庫的版本不對,老版本的庫確實沒有新加的接口。
這個時候就可以用nm命令看so中是否有提示找不到的符號。
輸入nm -h查看nm的選項如下:
用法:nm [選項] [文件]列舉 [文件] 中的符號 (默認為 a.out)。The options are:-a, --debug-syms Display debugger-only symbols-A, --print-file-name Print name of the input file before every symbol-B Same as --format=bsd-C, --demangle[=STYLE] Decode low-level symbol names into user-level namesThe STYLE, if specified, can be `auto' (the default),`gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'or `gnat'--no-demangle Do not demangle low-level symbol names-D, --dynamic Display dynamic symbols instead of normal symbols--defined-only Display only defined symbols-e (ignored)-f, --format=FORMAT Use the output format FORMAT. FORMAT can be `bsd',`sysv' or `posix'. The default is `bsd'-g, --extern-only Display only external symbols-l, --line-numbers Use debugging information to find a filename andline number for each symbol-n, --numeric-sort Sort symbols numerically by address-o Same as -A-p, --no-sort Do not sort the symbols-P, --portability Same as --format=posix-r, --reverse-sort Reverse the sense of the sort--plugin NAME Load the specified plugin-S, --print-size Print size of defined symbols-s, --print-armap Include index for symbols from archive members--size-sort Sort symbols by size--special-syms Include special symbols in the output--synthetic Display synthetic symbols as well-t, --radix=RADIX Use RADIX for printing symbol values--target=BFDNAME Specify the target object format as BFDNAME-u, --undefined-only Display only undefined symbols-X 32_64 (ignored)@FILE Read options from FILE-h, --help Display this information-V, --version Display this program's version numbernm:支持的目標: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 plugin srec symbolsrec verilog tekhex binary ihex 將 bug 報告到 <http://www.sourceware.org/bugzilla/>。總結
以上是生活随笔為你收集整理的linux命令之查看动态库符号-nm的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 流媒体服务器之rtp协议,rtcp协议,
- 下一篇: linux命令之查看动态库中字符串-st