About linux的strip命令

strip命令
The strip command removes the symbol table SHT_SYMTAB and its associated string table, debugging information, and line number information from ELF object files.
That is, besides the symbol table and associated string table, the following sections are removed:
.line
.debug*
.stab*
該命令從可執(zhí)行文件、動態(tài)鏈接庫, 等等, 二進制文件的ELF對象文件中刪除符號表SHT_SYMTAB, 行號信息, 調(diào)試信息, 字符串表;
命令一旦執(zhí)行成功, 那么gdb就讀不到這些文件的符號表了, 也就不能進行正常的調(diào)試了;
一、下面是對可執(zhí)行文件ISMG_LogServer_SOL10_GCC34_V500_090320執(zhí)行strip命令前后, gdb命令對它的調(diào)試信息的變化:
strip前,用gdb工具調(diào)試:
執(zhí)行strip命令:
strip ISMG_LogServer_SOL10_GCC34_V500_090320
string后,用gdb工具調(diào)試:
二、下面是對可執(zhí)行文件ISMG_LogServer_SOL10_GCC34_V500_090320執(zhí)行strip命令前后,文件大小的變化:
strip前,文件的大小:
執(zhí)行strip命令:
strip ISMG_LogServer_SOL10_GCC34_V500_090320
strip后,文件的大小:
arm-linux-strip
就像 arm-linux-gcc 是 gcc 的arm嵌入式對應版一樣,
arm-linux-strip
也是strip命令的對應版本。
另外:
strip操作是單向的,文件一單strip過就不能恢復原樣了;
如果文件大小沒有減小, 那就是已經(jīng)strip過了;
cc編譯時加上"-s
"參數(shù),具有同樣的作用。