6

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?

RzR
  • 3,068
  • 29
  • 26
theactiveactor
  • 7,314
  • 15
  • 52
  • 60
  • Logicor provided this answer. I'm going to reproduce it as a comment since its probably going away: *"Here is a more detailed explanation on this: https://gcc.gnu.org/onlinedocs/gccint/Initialization.html"*. – jww May 07 '15 at 23:48
  • Related: [Difference between crtbegin.o variants?](http://stackoverflow.com/q/22160888/608639). It does not look like a dup (otherwise, I would cast the first vote on my question). – jww May 07 '15 at 23:50

2 Answers2

11

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.

brantgurga
  • 1,128
  • 10
  • 14
-5

I think they relate to dynamic libraries (shared objects) and executables, but not quite sure. Hope this provides you a lead.