On February 15, 2015 12:57:18 PM CST, Alexander Monakov <amona...@ispras.ru> wrote: > > >On Sun, 15 Feb 2015, Cyd Haselton wrote: > >> On Sun, Feb 15, 2015 at 12:41 PM, Cyd Haselton <chasel...@gmail.com> >wrote: >> >> *snip* >> > >> >> So to obtain the pointer to >> >> dlopen the code like above can use dlsym(RTLD_DEFAULT, "dlopen"), >but not >> >> RTLD_NEXT (the loader precedes the fakeroot library in the lookup >chain). >> >> >> *snip* >> >> Just a quick update: RTLD_DEFAULT is definitely not the solution >here >> as it results in a segfault when libfakechroot loads. Perhaps a >> different RTLD_FLAG was meant? > >I think you need to use RTLD_DEFAULT only when resolving "dlopen", and >keep >RTLD_NEXT for all other symbol names (unless later on you run into >other >symbols with similar behavior). Something like > > ... = dlsym(strcmp(name, "dlopen") ? RTLD_NEXT : RTLD_DEFAULT, name); > >Alexander
I believe that worked perfectly; compiling Python no longer causes fakechroot to throw an undefined reference to dlopen(). Many, many thanks. For my future reference, are there recommended references/documentation for Android's linker in particular and dynamic linking, shared/static libraries, and symbol resolution in general...other than man dlopen/dlsym/etc? -- Sent from my Android device with K-9 Mail. Please excuse my brevity.