|
| 1 | +diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c |
| 2 | +index 7f8f134..bba560f 100644 |
| 3 | +--- a/Python/dynload_shlib.c |
| 4 | ++++ b/Python/dynload_shlib.c |
| 5 | +@@ -62,6 +62,20 @@ _PyImport_FindSharedFuncptr(const char *prefix, |
| 6 | + char pathbuf[260]; |
| 7 | + int dlopenflags=0; |
| 8 | + |
| 9 | ++ static void *libpymodules = NULL; |
| 10 | ++ void *rv = NULL; |
| 11 | ++ |
| 12 | ++ /* Ensure we have access to libpymodules. */ |
| 13 | ++ if (libpymodules == NULL) { |
| 14 | ++ printf("ANDROID_PRIVATE = %s\n", getenv("ANDROID_PRIVATE")); |
| 15 | ++ PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_PRIVATE")); |
| 16 | ++ libpymodules = dlopen(pathbuf, RTLD_NOW); |
| 17 | ++ |
| 18 | ++ if (libpymodules == NULL) { |
| 19 | ++ //abort(); |
| 20 | ++ } |
| 21 | ++ } |
| 22 | ++ |
| 23 | + if (strchr(pathname, '/') == NULL) { |
| 24 | + /* Prefix bare filename with "./" */ |
| 25 | + PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname); |
| 26 | +@@ -71,6 +85,16 @@ _PyImport_FindSharedFuncptr(const char *prefix, |
| 27 | + PyOS_snprintf(funcname, sizeof(funcname), |
| 28 | + LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname); |
| 29 | + |
| 30 | ++ |
| 31 | ++ /* Read symbols that have been linked into the main binary. */ |
| 32 | ++ |
| 33 | ++ if (libpymodules) { |
| 34 | ++ rv = dlsym(libpymodules, funcname); |
| 35 | ++ if (rv != NULL) { |
| 36 | ++ return rv; |
| 37 | ++ } |
| 38 | ++ } |
| 39 | ++ |
| 40 | + if (fp != NULL) { |
| 41 | + int i; |
| 42 | + struct _Py_stat_struct status; |
0 commit comments