OLD | NEW |
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 lm->dlh = GetModuleHandle(NULL); | 191 lm->dlh = GetModuleHandle(NULL); |
192 #endif /* ! XP_OS2 */ | 192 #endif /* ! XP_OS2 */ |
193 | 193 |
194 lm->refCount = 1; | 194 lm->refCount = 1; |
195 lm->staticTable = NULL; | 195 lm->staticTable = NULL; |
196 pr_exe_loadmap = lm; | 196 pr_exe_loadmap = lm; |
197 pr_loadmap = lm; | 197 pr_loadmap = lm; |
198 | 198 |
199 #elif defined(XP_UNIX) | 199 #elif defined(XP_UNIX) |
200 #ifdef HAVE_DLL | 200 #ifdef HAVE_DLL |
201 #ifdef USE_DLFCN | 201 #if defined(USE_DLFCN) && !defined(NO_DLOPEN_NULL) |
202 h = dlopen(0, RTLD_LAZY); | 202 h = dlopen(0, RTLD_LAZY); |
203 if (!h) { | 203 if (!h) { |
204 char *error; | 204 char *error; |
205 | 205 |
206 DLLErrorInternal(_MD_ERRNO()); | 206 DLLErrorInternal(_MD_ERRNO()); |
207 error = (char*)PR_MALLOC(PR_GetErrorTextLength()); | 207 error = (char*)PR_MALLOC(PR_GetErrorTextLength()); |
208 (void) PR_GetErrorText(error); | 208 (void) PR_GetErrorText(error); |
209 fprintf(stderr, "failed to initialize shared libraries [%s]\n", | 209 fprintf(stderr, "failed to initialize shared libraries [%s]\n", |
210 error); | 210 error); |
211 PR_DELETE(error); | 211 PR_DELETE(error); |
212 abort();/* XXX */ | 212 abort();/* XXX */ |
213 } | 213 } |
214 #elif defined(USE_HPSHL) | 214 #elif defined(USE_HPSHL) |
215 h = NULL; | 215 h = NULL; |
216 /* don't abort with this NULL */ | 216 /* don't abort with this NULL */ |
217 #elif defined(USE_MACH_DYLD) | 217 #elif defined(USE_MACH_DYLD) || defined(NO_DLOPEN_NULL) |
218 h = NULL; /* XXXX toshok */ | 218 h = NULL; /* XXXX toshok */ /* XXXX vlad */ |
219 #else | 219 #else |
220 #error no dll strategy | 220 #error no dll strategy |
221 #endif /* USE_DLFCN */ | 221 #endif /* USE_DLFCN */ |
222 | 222 |
223 lm = PR_NEWZAP(PRLibrary); | 223 lm = PR_NEWZAP(PRLibrary); |
224 if (lm) { | 224 if (lm) { |
225 lm->name = strdup("a.out"); | 225 lm->name = strdup("a.out"); |
226 lm->refCount = 1; | 226 lm->refCount = 1; |
227 lm->dlh = h; | 227 lm->dlh = h; |
228 lm->staticTable = NULL; | 228 lm->staticTable = NULL; |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 PR_ASSERT(lm->refCount == 1); | 1347 PR_ASSERT(lm->refCount == 1); |
1348 PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (static lib)", lm->nam
e)); | 1348 PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Loaded library %s (static lib)", lm->nam
e)); |
1349 unlock: | 1349 unlock: |
1350 PR_ExitMonitor(pr_linker_lock); | 1350 PR_ExitMonitor(pr_linker_lock); |
1351 return result; | 1351 return result; |
1352 } | 1352 } |
1353 | 1353 |
1354 PR_IMPLEMENT(char *) | 1354 PR_IMPLEMENT(char *) |
1355 PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr) | 1355 PR_GetLibraryFilePathname(const char *name, PRFuncPtr addr) |
1356 { | 1356 { |
1357 #if defined(USE_DLFCN) && (defined(SOLARIS) || defined(FREEBSD) \ | 1357 #if defined(USE_DLFCN) && !defined(ANDROID) && (defined(SOLARIS) || defined(FREE
BSD) \ |
1358 || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ | 1358 || defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \ |
1359 || defined(DARWIN)) | 1359 || defined(DARWIN)) |
1360 Dl_info dli; | 1360 Dl_info dli; |
1361 char *result; | 1361 char *result; |
1362 | 1362 |
1363 if (dladdr((void *)addr, &dli) == 0) { | 1363 if (dladdr((void *)addr, &dli) == 0) { |
1364 PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, _MD_ERRNO()); | 1364 PR_SetError(PR_LIBRARY_NOT_LOADED_ERROR, _MD_ERRNO()); |
1365 DLLErrorInternal(_MD_ERRNO()); | 1365 DLLErrorInternal(_MD_ERRNO()); |
1366 return NULL; | 1366 return NULL; |
1367 } | 1367 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 result = PR_Malloc(strlen(module_name)+1); | 1621 result = PR_Malloc(strlen(module_name)+1); |
1622 if (result != NULL) { | 1622 if (result != NULL) { |
1623 strcpy(result, module_name); | 1623 strcpy(result, module_name); |
1624 } | 1624 } |
1625 return result; | 1625 return result; |
1626 #else | 1626 #else |
1627 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 1627 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
1628 return NULL; | 1628 return NULL; |
1629 #endif | 1629 #endif |
1630 } | 1630 } |
OLD | NEW |