This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Android native build of GCC



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]