diff options
author | wtc%google.com <devnull@localhost> | 2008-12-13 19:34:10 +0000 |
---|---|---|
committer | wtc%google.com <devnull@localhost> | 2008-12-13 19:34:10 +0000 |
commit | 1258f41c14457da6db25d1899693c8a949de90fd (patch) | |
tree | 9c0d806958f256678ba851765e243917f737c5b1 | |
parent | bfea4fc4b80b72194c374e218b839c6c68d6bbd9 (diff) | |
download | nspr-hg-1258f41c14457da6db25d1899693c8a949de90fd.tar.gz |
Bug 370766: support 64-bit Mac OS X x86_64, which uses the dlopen functions
(declared in <dlfcn.h>) for dynamic library loading, and doesn't support
CFBundles. Contributed by Glen Beasley <glen.beasley@sun.com>. r=wtc.
-rw-r--r-- | pr/src/linking/prlink.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index fbbd3be5..c2d2d731 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -44,7 +44,7 @@ #include <image.h> #endif -#ifdef XP_MACOSX +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) #include <CodeFragments.h> #include <TextUtils.h> #include <Types.h> @@ -155,8 +155,8 @@ struct _imcb *IAC$GL_IMAGE_LIST = NULL; /* * On these platforms, symbols have a leading '_'. */ -#if defined(SUNOS4) || defined(DARWIN) || defined(NEXTSTEP) \ - || defined(WIN16) || defined(XP_OS2) \ +#if defined(SUNOS4) || (defined(DARWIN) && defined(USE_MACH_DYLD)) \ + || defined(NEXTSTEP) || defined(WIN16) || defined(XP_OS2) \ || ((defined(OPENBSD) || defined(NETBSD)) && !defined(__ELF__)) #define NEED_LEADING_UNDERSCORE #endif @@ -179,7 +179,7 @@ struct PRLibrary { #endif #endif -#ifdef XP_MACOSX +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) CFragConnectionID connection; CFBundleRef bundle; Ptr main; @@ -629,7 +629,7 @@ pr_LoadMachDyldModule(const char *name) } #endif -#ifdef XP_MACOSX +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) /* ** macLibraryLoadProc is a function definition for a Mac shared library @@ -788,7 +788,7 @@ pr_LoadViaDyld(const char *name, PRLibrary *lm) return (lm->dlh != NULL || lm->image != NULL) ? PR_SUCCESS : PR_FAILURE; } -#endif /* XP_MACOSX */ +#endif /* XP_MACOSX && USE_MACH_DYLD */ #ifdef WIN95 static HMODULE WINAPI @@ -926,7 +926,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) } #endif /* WIN32 || WIN16 */ -#ifdef XP_MACOSX +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) { int i; PRStatus status; @@ -954,7 +954,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) } #endif -#if defined(XP_UNIX) && !defined(XP_MACOSX) +#if defined(XP_UNIX) && !(defined(XP_MACOSX) && defined(USE_MACH_DYLD)) #ifdef HAVE_DLL { #if defined(USE_DLFCN) @@ -1018,7 +1018,7 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) pr_loadmap = lm; } #endif /* HAVE_DLL */ -#endif /* XP_UNIX */ +#endif /* XP_UNIX && !(XP_MACOSX && USE_MACH_DYLD) */ lm->refCount = 1; @@ -1299,7 +1299,7 @@ PR_UnloadLibrary(PRLibrary *lib) } #endif /* XP_PC */ -#ifdef XP_MACOSX +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) /* Close the connection */ if (lib->connection) CloseConnection(&(lib->connection)); @@ -1398,7 +1398,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) f = GetProcAddress(lm->dlh, name); #endif /* WIN32 || WIN16 */ -#ifdef XP_MACOSX +#if defined(XP_MACOSX) && defined(USE_MACH_DYLD) /* add this offset to skip the leading underscore in name */ #define SYM_OFFSET 1 if (lm->bundle) { @@ -1439,7 +1439,7 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) f = NULL; } #undef SYM_OFFSET -#endif /* XP_MACOSX */ +#endif /* XP_MACOSX && USE_MACH_DYLD */ #ifdef XP_BEOS if( B_NO_ERROR != get_image_symbol( (image_id)lm->dlh, name, B_SYMBOL_TYPE_TEXT, &f ) ) { @@ -1627,7 +1627,8 @@ PR_IMPLEMENT(char *) PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr) { #if defined(USE_DLFCN) && (defined(SOLARIS) || defined(FREEBSD) \ - || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)) + || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ + || defined(DARWIN)) Dl_info dli; char *result; |