Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is crtbegin.o and crtbegin_dynamic.o?

When debugging a link error (undefined reference to _dso_handle) using the Android x86 toolchain, I noticed it's statically linking crtbegin_dynamic.o. What is the purpose of this file? There is another similar crtbegin.o in the toolchain install directory that contains the missing symbol (_dso_handle). What is the difference between crtbegin.o and crtbegin_dynamic.o?

like image 896
theactiveactor Avatar asked Apr 25 '10 20:04

theactiveactor


1 Answers

C++ has global constructors and destructors. crtbegin.o and crtend.o deal with calling those constructors and destructors. The variants of crtbegin.o such as crtbeginS.o do the same thing for other types of executables such as static executables and shared libraries.

like image 106
brantgurga Avatar answered Oct 06 '22 21:10

brantgurga