]> git.saurik.com Git - apple/libc.git/blame - stdlib/FreeBSD/atexit.c.patch
Libc-391.4.1.tar.gz
[apple/libc.git] / stdlib / FreeBSD / atexit.c.patch
CommitLineData
3d9156a7
A
1--- atexit.c.orig 2004-03-11 13:16:53.000000000 -0800
2+++ atexit.c 2004-09-15 00:14:26.000000000 -0700
59e0d9fe
A
3@@ -45,6 +45,9 @@
4 #include <stdlib.h>
5 #include <unistd.h>
6 #include <pthread.h>
7+#if defined(__DYNAMIC__)
8+#include <mach-o/dyld.h>
9+#endif /* defined(__DYNAMIC__) */
10 #include "atexit.h"
11 #include "un-namespace.h"
12
13@@ -125,7 +128,11 @@
14 fn.fn_type = ATEXIT_FN_STD;
15 fn.fn_ptr.std_func = func;;
16 fn.fn_arg = NULL;
17+#if defined(__DYNAMIC__)
18+ fn.fn_dso = (void *)_dyld_get_image_header_containing_address((unsigned long) func);
19+#else /* ! defined(__DYNAMIC__) */
20 fn.fn_dso = NULL;
21+#endif /* defined(__DYNAMIC__) */
22
23 error = atexit_register(&fn);
24 return (error);
3d9156a7
A
25@@ -156,7 +163,7 @@
26 * handlers are called.
27 */
28 void
29-__cxa_finalize(void *dso)
30+__cxa_finalize(const void *dso)
31 {
32 struct atexit *p;
33 struct atexit_fn fn;