a gcc compiler optimization problem from my colleague

function-section

data-section

 

Could any one tell what exactly these two option do. I have not been
able to understand why we use them because as per the gcc man page,
these options increase the size of libraries and exe


This group is not appropriate to answer your question.
cf. http://gcc.gnu.org/lists.html

http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Optimize-Options.html

-ffunction-sections
-fdata-sections
Place each function or data item into its own section in the output file if the target supports arbitrary sections. The name of the function or the name of the data item determines the section's name in the output file.

Use these options on systems where the linker can perform optimizations to improve locality of reference in the instruction space. Most systems using the ELF object format and SPARC processors running Solaris 2 have linkers with such optimizations. AIX may have these optimizations in the future.

Only use these options when there are significant benefits from doing so. When you specify these options, the assembler and linker will create larger object and executable files and will also be slower. You will not be able to use gprof on all systems if you specify this option and you may have problems with debugging if you specify both this option and -g.

 

http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2007-08/msg00245.html

http://debugerror.blog.ccidnet.com/blog-htm-itemid-273860-do-showone-type-blog-uid-68775.html

http://sources.redhat.com/ml/crossgcc/2006-10/msg00036.html

http://www.nuoya.org/bbs/forum_posts.asp?TID=163&PN=1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值