1、簡介
readelf用來顯示一個或者多個elf格式的目標檔案的資訊,可以通過它的選項來控制顯示哪些資訊。
2、參數
-a --all 顯示全部資訊,等價於 -h -l -S -s -r -d -V -A -I.
-h --file-header 顯示elf檔案開始的檔案頭資訊.
-l --program-headers --segments 顯示程式頭(段頭)資訊(如果有的話)。
-S --section-headers --sections 顯示節頭資訊(如果有的話)。
-g --section-groups 顯示節組資訊(如果有的話)。
-t --section-details 顯示節的詳細資料(-S的)。
-s --syms --symbols 顯示符號表段中的項(如果有的話)。
-e --headers 顯示全部頭資訊,等價於: -h -l -S
-n --notes 顯示note段(核心注釋)的資訊。
-r --relocs 顯示可重定位段的資訊。
-u --unwind 顯示unwind段資訊。當前只支援IA64 ELF的unwind段資訊。
-d --dynamic 顯示動態段的資訊。
-V --version-info 顯示版本段的資訊。
-A --arch-specific 顯示CPU構架資訊。
-D --use-dynamic 使用動態段中的符號表顯示符號,而不是使用符號段。
-x <number or name> --hex-dump=<number or name> 以16進位方式顯示指定段內內容。number指定段表中段的索引,或字串指定檔案中的段名。
-w[liaprmfFsoR] or --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges] 顯示調試段中指定的內容。
-I --histogram 顯示符號的時候,顯示bucket list長度的柱狀圖。
-v --version 顯示readelf的版本資訊。
-H --help 顯示readelf所支援的命令列選項。
-W --wide 寬行輸出。
@file 可以將選項集中到一個檔案中,然後使用這個@file選項載入。
3、樣本
1)顯示動態段資訊
readelf -d <file_name>
例如:
readelf -d /bin/rm
Dynamic section at offset 0x9420 contains 24 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000c (INIT) 0x401470
。。。。