开发者

gcc crtbegin crtend

For what purpose 开发者_JS百科does gcc use crtbegin.o and crtend.o ?


Those files contain the code to handle C++ global constructors and destructors.


You need check the 'nm' output of the crtbegin, crtend and other crtxxx files to understand it properly.

These files contains code for constructors(initialization routines) and destructors(termination routines). These constructors and destructors are not be confused with C++ global Constructors/Destructors. These routines are called before the actual start("main") of the program.

The linker builds 2 list of functions CTOR_LIST(startup-time routines) and DTOR_LIST(exit-time routines) to be executed.

Refer: https://gcc.gnu.org/onlinedocs/gccint/Initialization.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜