Andes Workshop

It is currently Fri Mar 29, 2024 4:20 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: -ffunction-sections及-fdata-sections
PostPosted: Fri Mar 01, 2013 3:51 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
-ffunction-sections, -fdata-sections會使compiler為每個function和data分配獨立的section。 --gc-sections會使ld刪除沒有被使用的section。

ld以section作為最小的處理單元,只要一個section中有某個符號被引用,該section就會被放入output中。這些選項一起使用會從最終的輸出檔中刪除所有未被使用的function和data, 只包含用到的function和data。

-ffunction-sections, -fdata-sections加上--gc-sections可以減少code size。
更重要的是保持良好的coding習慣,常常review code。
gc-sections有時會造成debug information不正確,使得debug有些困擾。


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group