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. */
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__ */