日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux命令之查看动态库符号-nm

發布時間:2025/3/21 linux 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。