OSDN Git Service

* configure.ac (mips*-sde-elf*): New stanza. Add target-libiberty
[pf3gnuchains/gcc-fork.git] / gcc / config / darwin-crt3.c
index 1cbb4b5..ac5e039 100644 (file)
@@ -27,6 +27,9 @@ along with GCC; see the file COPYING.  If not, write to the Free
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* Don't do anything if we are compiling for a kext multilib. */
+#ifdef __PIC__
+
 /* It is incorrect to include config.h here, because this file is being
    compiled for the target, and hence definitions concerning only the host
    do not apply.  */
@@ -518,11 +521,17 @@ __cxa_atexit (cxa_atexit_callback func, void* arg, const void* dso)
 
 int atexit (atexit_callback func) __attribute__((visibility("hidden")));
 
+/* Use __dso_handle to allow even bundles that call atexit() to be unloaded
+   on 10.4.  */
+extern void __dso_handle;
+
 int
 atexit (atexit_callback func)
 {
   struct one_atexit_routine r;
   r.callback.ac = func;
   r.has_arg = 0;
-  return atexit_common (&r, NULL);
+  return atexit_common (&r, &__dso_handle);
 }
+
+#endif /* __PIC__ */