Android native build of GCC

Alexander Monakov amonakov@ispras.ru
Sun Feb 15 18:57:00 GMT 2015



On Sun, 15 Feb 2015, Cyd Haselton wrote:

> On Sun, Feb 15, 2015 at 12:41 PM, Cyd Haselton <chaselton@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



More information about the Gcc mailing list