看板 C_and_CPP 關於我們 聯絡資訊
請教各位大大, .c檔經gcc 編譯後會產生.o檔, 其中.o檔包含下述資料 Symbol Names Compiled code Constant data, eg. strings Imports - which symbols the compiled code references (gets fixed up by linker) Exports - which symbols the object file makes available to OTHER object files 如果我想要縮小.o檔的size,那我是要調整.c檔中的哪部分呢? 若是拿掉沒有用到的宣告 (string,int,array..等)會有幫助嗎? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.36.16.199 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1484811716.A.877.html
dijkstra: 有用strip拿掉不用的section嗎 01/19 16:21
descent: 一般是縮最後的執行檔, 你怎麼會想去縮 .o 呢? 01/19 20:17
Ommm5566: 換llvm 旗標加入-O3 不要-g 然後.c裡面不要寫東西 01/20 08:39
Bencrie: 要也是 -Os 吧 01/20 12:43
Schottky: .o 或 library 被 strip 之後就沒辦法 link 了吧? 01/21 02:21
Schottky: 一般都是 strip 最後的 binary 執行檔啊 01/21 02:21
Bencrie: strip 又不會砍 dynamic symbol table,當然可以 link 01/21 16:34