43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
|
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
|
||
|
index 7f8f134..bba560f 100644
|
||
|
--- a/Python/dynload_shlib.c
|
||
|
+++ b/Python/dynload_shlib.c
|
||
|
@@ -62,6 +62,20 @@ _PyImport_FindSharedFuncptr(const char *prefix,
|
||
|
char pathbuf[260];
|
||
|
int dlopenflags=0;
|
||
|
|
||
|
+ static void *libpymodules = NULL;
|
||
|
+ void *rv = NULL;
|
||
|
+
|
||
|
+ /* Ensure we have access to libpymodules. */
|
||
|
+ if (libpymodules == NULL) {
|
||
|
+ printf("ANDROID_PRIVATE = %s\n", getenv("ANDROID_PRIVATE"));
|
||
|
+ PyOS_snprintf(pathbuf, sizeof(pathbuf), "%s/libpymodules.so", getenv("ANDROID_PRIVATE"));
|
||
|
+ libpymodules = dlopen(pathbuf, RTLD_NOW);
|
||
|
+
|
||
|
+ if (libpymodules == NULL) {
|
||
|
+ //abort();
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
if (strchr(pathname, '/') == NULL) {
|
||
|
/* Prefix bare filename with "./" */
|
||
|
PyOS_snprintf(pathbuf, sizeof(pathbuf), "./%-.255s", pathname);
|
||
|
@@ -71,6 +85,16 @@ _PyImport_FindSharedFuncptr(const char *prefix,
|
||
|
PyOS_snprintf(funcname, sizeof(funcname),
|
||
|
LEAD_UNDERSCORE "%.20s_%.200s", prefix, shortname);
|
||
|
|
||
|
+
|
||
|
+ /* Read symbols that have been linked into the main binary. */
|
||
|
+
|
||
|
+ if (libpymodules) {
|
||
|
+ rv = dlsym(libpymodules, funcname);
|
||
|
+ if (rv != NULL) {
|
||
|
+ return rv;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
if (fp != NULL) {
|
||
|
int i;
|
||
|
struct _Py_stat_struct status;
|