| @@ -1,37 +1,37 @@ | | | @@ -1,37 +1,37 @@ |
1 | $NetBSD: patch-ac,v 1.13 2009/11/10 18:35:13 wiz Exp $ | | 1 | $NetBSD: patch-ac,v 1.14 2009/11/10 23:31:36 asau Exp $ |
2 | | | 2 | |
3 | --- dyn_load.c.orig 2007-12-18 23:37:12.000000000 +0000 | | 3 | --- dyn_load.c.orig 2007-12-19 02:37:12.000000000 +0300 |
4 | +++ dyn_load.c | | 4 | +++ dyn_load.c 2009-11-11 01:54:26.000000000 +0300 |
5 | @@ -78,6 +78,8 @@ static int (*GC_has_static_roots)(const | | 5 | @@ -78,6 +78,8 @@ |
6 | #endif | | 6 | #endif |
7 | | | 7 | |
8 | #if defined(NETBSD) | | 8 | #if defined(NETBSD) |
9 | +# include <sys/param.h> | | 9 | +# include <sys/param.h> |
10 | +# include <dlfcn.h> | | 10 | +# include <dlfcn.h> |
11 | # include <machine/elf_machdep.h> | | 11 | # include <machine/elf_machdep.h> |
12 | # define ELFSIZE ARCH_ELFSIZE | | 12 | # define ELFSIZE ARCH_ELFSIZE |
13 | #endif | | 13 | #endif |
14 | @@ -499,6 +501,15 @@ GC_FirstDLOpenedLinkMap() | | 14 | @@ -499,6 +501,15 @@ |
15 | return(0); | | 15 | return(0); |
16 | } | | 16 | } |
17 | if( cachedResult == 0 ) { | | 17 | if( cachedResult == 0 ) { |
18 | +#if defined(NETBSD) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 599001900 | | 18 | +#if defined(NETBSD) && defined(RTLD_DI_LINKMAP) |
19 | + struct link_map *lm = NULL; | | 19 | + struct link_map *lm = NULL; |
20 | + int rv = dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lm); | | 20 | + int rv = dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &lm); |
21 | + if (rv != 0) | | 21 | + if (rv != 0) |
22 | + return (0); | | 22 | + return (0); |
23 | + if (lm == NULL) | | 23 | + if (lm == NULL) |
24 | + return (0); | | 24 | + return (0); |
25 | + cachedResult = lm; | | 25 | + cachedResult = lm; |
26 | +#else /* !(defined(NETBSD) && __NetBSD_Version__ >= 599001900) */ | | 26 | +#else /* !(defined(NETBSD) && defined(RTLD_DI_LINKMAP)) */ |
27 | int tag; | | 27 | int tag; |
28 | for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) { | | 28 | for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) { |
29 | if( tag == DT_DEBUG ) { | | 29 | if( tag == DT_DEBUG ) { |
30 | @@ -508,6 +519,7 @@ GC_FirstDLOpenedLinkMap() | | 30 | @@ -508,6 +519,7 @@ |
31 | break; | | 31 | break; |
32 | } | | 32 | } |
33 | } | | 33 | } |
34 | +#endif /* !(defined(NETBSD) && __NetBSD_Version__ >= 599001900) */ | | 34 | +#endif /* !(defined(NETBSD) && __NetBSD_Version__ >= 599001900) */ |
35 | } | | 35 | } |
36 | return cachedResult; | | 36 | return cachedResult; |
37 | } | | 37 | } |