开发者

gcc crtbegin crtend

开发者 https://www.devze.com 2023-01-03 18:51 出处:网络
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, crt

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

精彩评论

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