[haiku-commits] r39299 - haiku/trunk/src/system/runtime_loader

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 4 Nov 2010 17:22:11 +0100 (CET)

Author: bonefish
Date: 2010-11-04 17:22:11 +0100 (Thu, 04 Nov 2010)
New Revision: 39299
Changeset: http://dev.haiku-os.org/changeset/39299

Modified:
   haiku/trunk/src/system/runtime_loader/elf.cpp
Log:
unload_library(): Added comment about the exit hook handling.


Modified: haiku/trunk/src/system/runtime_loader/elf.cpp
===================================================================
--- haiku/trunk/src/system/runtime_loader/elf.cpp       2010-11-04 16:21:20 UTC 
(rev 39298)
+++ haiku/trunk/src/system/runtime_loader/elf.cpp       2010-11-04 16:22:11 UTC 
(rev 39299)
@@ -612,7 +612,18 @@
 
        if (status == B_OK) {
                while ((image = get_disposable_images().head) != NULL) {
-                       // call image fini here...
+                       // Call the exit hooks that live in this image.
+                       // Note: With the Itanium ABI this shouldn't really be 
done this
+                       // way anymore, since global destructors are registered 
via
+                       // __cxa_atexit() (the ones that are registered 
dynamically) and the
+                       // termination routine should call __cxa_finalize() for 
the image.
+                       // The reason why we still do it is that hooks 
registered with
+                       // atexit() aren't associated with the image. We could 
find out
+                       // there which image the hooks lives in and register it
+                       // respectively, but since that would be done always, 
that's
+                       // probably more expensive than calling
+                       // call_atexit_hooks_for_range() only here, which 
happens only when
+                       // libraries are unloaded dynamically.
                        if (gRuntimeLoader.call_atexit_hooks_for_range) {
                                gRuntimeLoader.call_atexit_hooks_for_range(
                                        image->regions[0].vmstart, 
image->regions[0].vmsize);


Other related posts:

  • » [haiku-commits] r39299 - haiku/trunk/src/system/runtime_loader - ingo_weinhold