diff options
author | wtchang%redhat.com <devnull@localhost> | 2005-11-07 22:07:32 +0000 |
---|---|---|
committer | wtchang%redhat.com <devnull@localhost> | 2005-11-07 22:07:32 +0000 |
commit | 388409dc297e2ad553508c19b36e5bf8985ddd1a (patch) | |
tree | 90fc438586a8ce0ff906446f8f9334e6a21a6a43 | |
parent | d85e104ef3ffdb6355b5750ba0a00281bd983466 (diff) | |
download | nspr-hg-388409dc297e2ad553508c19b36e5bf8985ddd1a.tar.gz |
Bugzilla Bug 314070: do not use CFM on Mac OS X x86. The patch is
contributed by Mark Mentovai <mark@moxienet.com>. r=wtc,joshmoz
Tag: NSPRPUB_PRE_4_2_CLIENT_BRANCH
-rw-r--r-- | pr/src/linking/prlink.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/pr/src/linking/prlink.c b/pr/src/linking/prlink.c index 55831bf7..0341521e 100644 --- a/pr/src/linking/prlink.c +++ b/pr/src/linking/prlink.c @@ -599,6 +599,23 @@ pr_LoadMachDyldModule(const char *name) #ifdef XP_MACOSX +/* +** macLibraryLoadProc is a function definition for a Mac shared library +** loading method. The "name" param is the same full or partial pathname +** that was passed to pr_LoadLibraryByPathName. The function must fill +** in the fields of "lm" which apply to its library type. Returns +** PR_SUCCESS if successful. +*/ + +typedef PRStatus (*macLibraryLoadProc)(const char *name, PRLibrary *lm); + +#ifdef __ppc__ + +/* +** CFM and its TVectors only exist on PowerPC. Other OS X architectures +** only use Mach-O as a native binary format. +*/ + static void* TV2FP(CFMutableDictionaryRef dict, const char* name, void *tvp) { static uint32 glue[6] = { 0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420 }; @@ -633,16 +650,6 @@ static void* TV2FP(CFMutableDictionaryRef dict, const char* name, void *tvp) return newGlue; } -/* -** macLibraryLoadProc is a function definition for a Mac shared library -** loading method. The "name" param is the same full or partial pathname -** that was passed to pr_LoadLibraryByPathName. The function must fill -** in the fields of "lm" which apply to its library type. Returns -** PR_SUCCESS if successful. -*/ - -typedef PRStatus (*macLibraryLoadProc)(const char *name, PRLibrary *lm); - static PRStatus pr_LoadViaCFM(const char *name, PRLibrary *lm) { @@ -691,6 +698,7 @@ pr_LoadViaCFM(const char *name, PRLibrary *lm) } return (err == noErr) ? PR_SUCCESS : PR_FAILURE; } +#endif /* __ppc__ */ /* ** Creates a CFBundleRef if the pathname refers to a Mac OS X bundle @@ -812,7 +820,11 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags) PRStatus status; static const macLibraryLoadProc loadProcs[] = { +#ifdef __ppc__ pr_LoadViaDyld, pr_LoadCFBundle, pr_LoadViaCFM +#else /* __ppc__ */ + pr_LoadViaDyld, pr_LoadCFBundle +#endif /* __ppc__ */ }; for (i = 0; i < sizeof(loadProcs) / sizeof(loadProcs[0]); i++) { @@ -1169,10 +1181,12 @@ pr_FindSymbolInLib(PRLibrary *lm, const char *name) f = (FindSymbol(lm->connection, pName, &symAddr, &symClass) == noErr) ? symAddr : NULL; +#ifdef __ppc__ /* callers expect mach-o function pointers, so must wrap tvectors with glue. */ if (f && symClass == kTVectorCFragSymbol) { f = TV2FP(lm->wrappers, name + SYM_OFFSET, f); } +#endif /* __ppc__ */ if (f == NULL && strcmp(name + SYM_OFFSET, "main") == 0) f = lm->main; } @@ -1390,7 +1404,7 @@ PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr) return result; #elif defined(USE_MACH_DYLD) char *result; - char *image_name; + const char *image_name; int i, count = _dyld_image_count(); for (i = 0; i < count; i++) { |