1. 程式人生 > >通過readelf檢視動態庫中的內容

通過readelf檢視動態庫中的內容

readelf是unix下檢視庫中連結的內容工具。elf:Executable and Linkable Format

mac下的安裝以及使用方法:

1、下載binutils-2.24.tar.gz

2、解壓

3、安裝(使用disable-werror是為了防止mac上make不通過,參考http://stackoverflow.com/questions/20426213/error-building-ellcc)

./configure --disable-werror
make
make install

4、檢視可執行檔案中連結進去的內容:

➜  assets  readelf -Ws your_executable_file

Symbol table '.dynsym' contains 162 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000000     0 FUNC    GLOBAL DEFAULT  UND __libc_init
     2: 00000000     0 FUNC    GLOBAL DEFAULT  UND __cxa_atexit
     3: 00000000     0 FUNC    GLOBAL DEFAULT  UND __android_log_print
     4: 00000000     0 FUNC    GLOBAL DEFAULT  UND gettimeofday
     5: 00000000     0 FUNC    GLOBAL DEFAULT  UND access
     6: 0001196c     0 FUNC    GLOBAL DEFAULT  UND malloc
     7: 00000000     0 FUNC    GLOBAL DEFAULT  UND exit
     8: 00000000     0 FUNC    GLOBAL DEFAULT  UND inotify_init
     9: 00000000     0 FUNC    GLOBAL DEFAULT  UND inotify_add_watch
    10: 00000000     0 FUNC    GLOBAL DEFAULT  UND read
    11: 00000000     0 FUNC    GLOBAL DEFAULT  UND system
    12: 00000000     0 FUNC    GLOBAL DEFAULT  UND pthread_create
    13: 00000000     0 FUNC    GLOBAL DEFAULT  UND usleep
    14: 00000000     0 FUNC    GLOBAL DEFAULT  UND fopen
    15: 000119d8     0 FUNC    GLOBAL DEFAULT  UND free
    16: 00000000     0 FUNC    GLOBAL DEFAULT  UND time
    17: 00000000     0 FUNC    GLOBAL DEFAULT  UND localtime
    18: 00000000     0 FUNC    GLOBAL DEFAULT  UND asctime
    19: 00000000     0 FUNC    GLOBAL DEFAULT  UND fprintf
    20: 00000000     0 FUNC    GLOBAL DEFAULT  UND fclose
    21: 00000000     0 FUNC    GLOBAL DEFAULT  UND strcpy
    22: 00000000     0 FUNC    GLOBAL DEFAULT  UND strcat
    23: 00000000     0 FUNC    GLOBAL DEFAULT  UND snprintf
    24: 00000000     0 FUNC    GLOBAL DEFAULT  UND inotify_rm_watch
    25: 00000000     0 FUNC    GLOBAL DEFAULT  UND close
    26: 00000000     0 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail
    27: 00000000     0 OBJECT  GLOBAL DEFAULT  UND __stack_chk_guard
    28: 00000000     0 FUNC    GLOBAL DEFAULT  UND fstat
    29: 00000000     0 FUNC    GLOBAL DEFAULT  UND lseek
    30: 00000000     0 FUNC    GLOBAL DEFAULT  UND open
    31: 00000000     0 FUNC    GLOBAL DEFAULT  UND strchr
    32: 00000000     0 FUNC    GLOBAL DEFAULT  UND fwrite
    33: 00000000     0 FUNC    GLOBAL DEFAULT  UND strtoll
    34: 00000000     0 FUNC    GLOBAL DEFAULT  UND isspace
    35: 00000000     0 FUNC    GLOBAL DEFAULT  UND strlen
    36: 00000000     0 FUNC    GLOBAL DEFAULT  UND inet_ntop
    37: 00000000     0 FUNC    GLOBAL DEFAULT  UND tolower
    38: 00000000     0 FUNC    GLOBAL DEFAULT  UND sigaction
    39: 00000000     0 FUNC    GLOBAL DEFAULT  UND alarm
    40: 00000000     0 FUNC    GLOBAL DEFAULT  UND sigsetjmp
    41: 00000000     0 FUNC    GLOBAL DEFAULT  UND siglongjmp
    42: 00000000     0 FUNC    GLOBAL DEFAULT  UND sscanf
    43: 00000000     0 FUNC    GLOBAL DEFAULT  UND fflush
    44: 00000000     0 FUNC    GLOBAL DEFAULT  UND fread
    45: 00000000     0 OBJECT  GLOBAL DEFAULT  UND __sF
    46: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_memcpy
    47: 00000000     0 FUNC    GLOBAL DEFAULT  UND stat
    48: 00000000     0 FUNC    GLOBAL DEFAULT  UND basename
    49: 00000000     0 FUNC    GLOBAL DEFAULT  UND memcpy
    50: 00000000     0 FUNC    GLOBAL DEFAULT  UND fgets
    51: 00000000     0 FUNC    GLOBAL DEFAULT  UND strtol
    52: 00000000     0 FUNC    GLOBAL DEFAULT  UND strrchr
    53: 00000000     0 FUNC    GLOBAL DEFAULT  UND strncmp
    54: 00000000     0 FUNC    GLOBAL DEFAULT  UND strtok_r
    55: 00000000     0 FUNC    GLOBAL DEFAULT  UND strcmp
    56: 00000000     0 FUNC    GLOBAL DEFAULT  UND qsort
    57: 00000000     0 FUNC    GLOBAL DEFAULT  UND fputs
    58: 00000000     0 FUNC    GLOBAL DEFAULT  UND memmove
    59: 00000000     0 FUNC    GLOBAL DEFAULT  UND strstr
    60: 00000000     0 FUNC    GLOBAL DEFAULT  UND memchr
    61: 00000000     0 FUNC    GLOBAL DEFAULT  UND isdigit
    62: 00000000     0 FUNC    GLOBAL DEFAULT  UND send
    63: 00000000     0 FUNC    GLOBAL DEFAULT  UND __errno
    64: 00000000     0 FUNC    GLOBAL DEFAULT  UND recv
    65: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_memmove
    66: 00000000     0 FUNC    GLOBAL DEFAULT  UND __aeabi_memset
    67: 00000000     0 FUNC    GLOBAL DEFAULT  UND strncpy
    68: 00000000     0 FUNC    GLOBAL DEFAULT  UND inet_pton
    69: 00000000     0 FUNC    GLOBAL DEFAULT  UND strtoul
    70: 00000000     0 FUNC    GLOBAL DEFAULT  UND getsockname
    71: 00000000     0 FUNC    GLOBAL DEFAULT  UND bind
    72: 00000000     0 FUNC    GLOBAL DEFAULT  UND listen
    73: 00000000     0 FUNC    GLOBAL DEFAULT  UND accept
    74: 00000000     0 FUNC    GLOBAL DEFAULT  UND strcasecmp
    75: 00000000     0 FUNC    GLOBAL DEFAULT  UND isxdigit
    76: 00000000     0 FUNC    GLOBAL DEFAULT  UND socket
    77: 00000000     0 FUNC    GLOBAL DEFAULT  UND ioctl
    78: 00146d5c   160 FUNC    GLOBAL DEFAULT    8 MD5_Init
    79: 00144070   688 FUNC    GLOBAL DEFAULT    8 MD5_Update
    80: 00146908  1108 FUNC    GLOBAL DEFAULT    8 MD5_Final
    81: 00000000     0 FUNC    GLOBAL DEFAULT  UND memcmp
    82: 00000000     0 FUNC    GLOBAL DEFAULT  UND zlibVersion
    83: 00000000     0 FUNC    GLOBAL DEFAULT  UND getenv
    84: 00000000     0 FUNC    GLOBAL DEFAULT  UND sprintf
    85: 00000000     0 FUNC    GLOBAL DEFAULT  UND fputc
    86: 00000000     0 FUNC    GLOBAL DEFAULT  UND atoi
    87: 00000000     0 FUNC    GLOBAL DEFAULT  UND geteuid
    88: 00000000     0 FUNC    GLOBAL DEFAULT  UND getpwuid
    89: 00000000     0 FUNC    GLOBAL DEFAULT  UND fseek
    90: 00000000     0 FUNC    GLOBAL DEFAULT  UND bsd_signal
    91: 00000000     0 FUNC    GLOBAL DEFAULT  UND strncasecmp
    92: 00011d38     0 FUNC    GLOBAL DEFAULT  UND calloc
    93: 00011d2c     0 FUNC    GLOBAL DEFAULT  UND strdup
    94: 00011d20     0 FUNC    GLOBAL DEFAULT  UND realloc
    95: 00000000     0 FUNC    GLOBAL DEFAULT  UND isprint
    96: 00000000     0 FUNC    GLOBAL DEFAULT  UND isalnum
    97: 00000000     0 FUNC    GLOBAL DEFAULT  UND isalpha
    98: 00000000     0 FUNC    GLOBAL DEFAULT  UND isupper
    99: 00000000     0 FUNC    GLOBAL DEFAULT  UND islower
   100: 00000000     0 FUNC    GLOBAL DEFAULT  UND isgraph
   101: 00000000     0 FUNC    GLOBAL DEFAULT  UND getpeername
   102: 00000000     0 FUNC    GLOBAL DEFAULT  UND getsockopt
   103: 00000000     0 FUNC    GLOBAL DEFAULT  UND connect
   104: 00000000     0 FUNC    GLOBAL DEFAULT  UND setsockopt
   105: 00000000     0 FUNC    GLOBAL DEFAULT  UND inflateInit_
   106: 00000000     0 FUNC    GLOBAL DEFAULT  UND inflate
   107: 00000000     0 FUNC    GLOBAL DEFAULT  UND inflateEnd
   108: 00000000     0 FUNC    GLOBAL DEFAULT  UND inflateInit2_
   109: 00000000     0 FUNC    GLOBAL DEFAULT  UND strerror_r
   110: 00000000     0 FUNC    GLOBAL DEFAULT  UND gmtime_r
   111: 00000000     0 FUNC    GLOBAL DEFAULT  UND select
   112: 00000000     0 FUNC    GLOBAL DEFAULT  UND recvfrom
   113: 00000000     0 FUNC    GLOBAL DEFAULT  UND sendto
   114: 00000000     0 FUNC    GLOBAL DEFAULT  UND strlcat
   115: 00000000     0 FUNC    GLOBAL DEFAULT  UND getaddrinfo
   116: 00000000     0 FUNC    GLOBAL DEFAULT  UND freeaddrinfo
   117: 00000000     0 FUNC    GLOBAL DEFAULT  UND fcntl
   118: 00000000     0 FUNC    GLOBAL DEFAULT  UND toupper
   119: 00000000     0 FUNC    GLOBAL DEFAULT  UND gethostname
   120: 00000000     0 FUNC    GLOBAL DEFAULT  UND waitpid
   121: 00000000     0 FUNC    GLOBAL DEFAULT  UND kill
   122: 00000000     0 FUNC    GLOBAL DEFAULT  UND strpbrk
   123: 00000000     0 FUNC    GLOBAL DEFAULT  UND socketpair
   124: 00000000     0 FUNC    GLOBAL DEFAULT  UND fork
   125: 00000000     0 FUNC    GLOBAL DEFAULT  UND dup2
   126: 00000000     0 FUNC    GLOBAL DEFAULT  UND execl
   127: 00000000     0 FUNC    GLOBAL DEFAULT  UND abort
   128: 00000000     0 FUNC    GLOBAL DEFAULT  UND gethostbyname
   129: 00000000     0 FUNC    GLOBAL DEFAULT  UND getservbyname
   130: 00000000     0 FUNC    GLOBAL DEFAULT  UND shutdown
   131: 00000000     0 FUNC    GLOBAL DEFAULT  UND write
   132: 00000000     0 FUNC    GLOBAL DEFAULT  UND perror
   133: 00000000     0 FUNC    GLOBAL DEFAULT  UND ftell
   134: 00000000     0 FUNC    GLOBAL DEFAULT  UND closelog
   135: 00000000     0 FUNC    GLOBAL DEFAULT  UND openlog
   136: 00000000     0 FUNC    GLOBAL DEFAULT  UND syslog
   137: 00000000     0 FUNC    GLOBAL DEFAULT  UND getpid
   138: 00000000     0 FUNC    GLOBAL DEFAULT  UND vfprintf
   139: 00000000     0 FUNC    GLOBAL DEFAULT  UND dlopen
   140: 00000000     0 FUNC    GLOBAL DEFAULT  UND dlerror
   141: 00000000     0 FUNC    GLOBAL DEFAULT  UND dlclose
   142: 00000000     0 FUNC    GLOBAL DEFAULT  UND dlsym
   143: 00000000     0 FUNC    GLOBAL DEFAULT  UND strerror
   144: 00000000     0 FUNC    GLOBAL DEFAULT  UND opendir
   145: 00000000     0 FUNC    GLOBAL DEFAULT  UND readdir
   146: 00000000     0 FUNC    GLOBAL DEFAULT  UND closedir
   147: 00000000     0 FUNC    GLOBAL DEFAULT  UND printf
   148: 00000000     0 FUNC    GLOBAL DEFAULT  UND poll
   149: 00000000     0 FUNC    GLOBAL DEFAULT  UND getuid
   150: 00000000     0 FUNC    GLOBAL DEFAULT  UND setvbuf
   151: 00000000     0 FUNC    GLOBAL DEFAULT  UND chmod
   152: 00000000     0 FUNC    GLOBAL DEFAULT  UND getgid
   153: 00000000     0 FUNC    GLOBAL DEFAULT  UND getegid
   154: 00000000     0 FUNC    GLOBAL DEFAULT  UND raise
   155: 00000000     0 FUNC    WEAK   DEFAULT  UND __gnu_Unwind_Find_exidx
   156: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __cxa_begin_cleanup
   157: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __cxa_type_match
   158: 00000000     0 NOTYPE  WEAK   DEFAULT  UND __cxa_call_unexpected
   159: 001e2d84     0 NOTYPE  GLOBAL DEFAULT  ABS _edata
   160: 001e2d84     0 NOTYPE  GLOBAL DEFAULT  ABS __bss_start
   161: 001e4ea0     0 NOTYPE  GLOBAL DEFAULT  ABS _end
從上面結果看出,這個可執行檔案中連結了比如pthread_create、time等

相關推薦

通過readelf檢視動態內容

readelf是unix下檢視庫中連結的內容工具。elf:Executable and Linkable Format mac下的安裝以及使用方法: 1、下載binutils-2.24.tar.gz 2、解壓 3、安裝(使用disable-werror是為了防止mac上ma

linux下檢視動態的符號

功能 列出.o .a .so中的符號資訊,包括諸如符號的值,符號型別及符號名稱等。所謂符號,通常指定義出的函式,全域性變數等等。 使用 nm [option(s)] [file(s)] 有用的options: -A 在每個符號資訊的前面列印所在物件檔名稱;-C

c++檢視動態函式地址

我們知道在生成動態庫時,如果使用.def檔案.那麼可以在.def中定義函式地址即例: add @1這種方式.但畢竟這是一種取巧的方式,如果你想獲得任何一個動態庫中函式地址,那麼我這邊可以提供兩個方法.(1)使用vs自帶的功能我用的是VS2005開啟工具選項,下面有Visual

如何檢視linux動態包含哪些函式

1、方法1 nm *.so 2、方法2 readelf -a *.so PS:readelf Options are: -a --all Equivalent to: -h -l -S -s -r -d -V -A -I

使用objdump檢視動態和靜態具有哪些函式

 我們在 Linux 下執行一個程式,有時會無法啟動,報缺少某某庫。這時需要檢視可執行程式或者動態庫中的符號表,動態庫的依賴項, Linux 有現成的工具可用:objdump 。 objdump 是 gcc 套件中用來檢視 ELF 檔案的工具,具體詳細用法不進行介紹,此

linux crash在動態通過map查詢crash位置

linux程序crash時,通常我們可以通過gdb+core或addr2line解析出程序crash在哪一個函式中,有時crash在動態連結庫中,解析出的core可能只有一個地址,而不能知道是在哪一個函式,這時可以嘗試通過/proc/程序ID/maps的方法找到crash的

c++動態使用命名空間的問題

family 不能 eight 函數 names bsp ++ data- color 這是C++才會有的語言特性. 假如你使用一個程序庫,他裏面有桓霰淞拷衋bc,可是你自己也不小心定義了一個叫abc的變量,這樣就會引起重定義錯誤.所以為了避免這樣

C#調用非托管動態的函數方法

left tom -c too normal evel idt col class C#如何調用一個非托管動態庫中的函數呢,比如用VC6寫的動態庫,總之C#調用動態庫的過程是比Java調用DLL動態庫方便快捷多了,下面舉例說明這個過程。 1、創建一個非托管動態庫 代碼

linux 常用命令 zcat 檢視壓縮檔案內容

zcat的用處是可以在不用解壓壓縮檔案就可以檢視檔案內的內容 有時候log檔案眾多,為了減少儲存空間就會將log檔案壓縮,這是zcat就可以檢視壓縮檔案內容。 -S:指定gzip格式的壓縮包的字尾。當字尾不是標準壓縮包(zip)字尾時使用此選項; -c:將檔案內容寫到標註輸出; -d:執行解壓縮操作; -

Android 檢視動態依賴的檔案

參考:http://blog.csdn.net/renwotao2009/article/details/51398739   最近工作過程中,遇到了一個庫檔案開啟失敗的問題,需要檢視so檔案依賴哪些動態庫。之前看到有同事用到ldd命令,但是本地使用ldd命令來解析arm的動態庫是不行

關於通過網頁檢視JS原始碼漢字顯示亂碼的解決方法

開頭貼出原文地址 在網頁中讀取js檔案,中文顯示正常(比如alert出js檔案的中文資訊)。但當瀏覽器檢視js檔案原始碼時,則會看到程式碼裡的中文全是亂碼。雖然不影響程式執行,但是在讀js檔案程式碼時,會受影響。 前幾天在瀏覽器檢視自己寫的web程式碼的時候,發現外聯js檔案的漢字註釋顯

linux命令之檢視動態符號-nm

在呼叫動態庫的時候,經常出現由於動態庫介面修改或者版本不匹配導致呼叫動態庫找不到函式介面符號的情況。 原因可能有如下幾種: 1.由於c++動態庫編譯沒有加extern c導致函式編譯時加了c++的字首的; 2.系統中有多個庫,程式載入了其他路徑的庫; 3.庫的版本不對,老版

如何使用gcc檢查動態符號的完整性

Check out the linker option "-z defs" / "--no-undefined". When creating a shared object, it will cause the link to fail if there are unr

ios  多個.framework和.a內容出現衝突問題,對其進行分解》去重》合併

專案中遇到的庫三個庫的衝突的問題(libNodeMediaClient.a 和FunSDK.framework 和IJKMediaFramework.framework )。 一,進入libNodeMediaClient.a資料夾下檢視資訊並進行分解  檢視libNodeM

【Xcode使用技巧】通過Xcode檢視真機應用程式的資料檔案

有時候開發除錯時,需要檢視真機中應用的檔案,比如sqlite之類的,可按以下步驟進行: 環境:Xcode Version 7.2.1,iPad2。 1)點選Xcode的Window選單項,選擇Devices選項。 2)點選左邊裝置一覽中的iPad2,右邊「

mysql 檢視某個的一個表是哪些表的外來鍵

#檢視資料庫所有表 1 SELECT tba.TABLE_NAME&n

linux 使用readelf命令檢視.so動態的真實名

linux strip 可以去除連結資訊 讓nm看不到 但是readelf 用-s引數 仍然可以看到 例如readelf -s libACE-5.7.1.so 使用readelf檢視動態庫的真實名字 readelf -d 動態庫檔案 檢視共享庫的依賴庫(NEEDED)和搜尋

Linux的nm檢視動態和靜態的符號

功能 列出.o .a .so中的符號資訊,包括諸如符號的值,符號型別及符號名稱等。所謂符號,通常指定義出的函式,全域性變數等等。 使用 nm [option(s)] [file(s)] 有用的options: -A 在每個符號資訊的前面列印所在物件檔名稱;-C

通過反射呼叫動態連線的方法

[Description("通過DLL路徑,實現動態呼叫動態連結庫中指定類的(靜態)方法和屬性")]       public class DynamicReflectDLL : MarshalByRefObject         {             #regio

html頁面通過http訪問mysql數據內容,實現用戶登錄的功能

默認 存在 apache ron username 問題 登錄界面 ble rom 需求:   通過html編寫用戶登錄頁面,頁面內容包括用戶名、密碼和登錄按鈕,點擊登錄後訪問login.php文件,使用按鈕默認的submit提交用戶名和密碼,在login.php中訪問my