While not directly related to this scenario, there is at least 1 bug
in the linker that I know about - 
http://code.google.com/p/android/issues/detail?id=2042.
I wouldn't necessarily say that the situation described in this thread
is a bug though.  It sounds more like a problem with the library sizes
and not being given enough room in memory from the prelink map.

I'm not exactly sure of all the pros and cons of using the prelink
map, but at the very least, it's supposed to load the libraries faster
since the memory address is set at build time.  I haven't looked, but
there may be some other discussions about the prelink map file in the
android groups somewhere.  That might give you some better information
for your decision on whether to keep your library in the prelink map
or not.

-Brock

On Apr 20, 1:20 am, hsiung <cdhsi...@gmail.com> wrote:
> Hi Brock,
>
> I have tried the first approach. It works. Thanks.
>
> Does it mean that we have some bugs in the dynamic linking loader?
> To avoid this kind of problem, should we complete discard prelink?
>
> Hank
>
> On Apr 17, 10:15 pm, Brock A <batchi...@pv.com> wrote:
>
> > You could try adding LOCAL_PRELINK_MODULE := false to the Android.mk
> > and removing the library from the prelink map.  That might avoid the
> > problem if it's related to the location of the library in memory.
>
> > Also, I've seen dlopen fail if you give the library -just- enough
> > space in the prelink map file.  I never debugged the issue further.
> > Giving it just a little breathing room in memory seemed to resolve the
> > issue.
>
> > -Brock
>
> > On Apr 17, 2:53 am, Hank <hank.and.gr...@gmail.com> wrote:
>
> > > Hi,
>
> > > I traced the problem a little bit deeper. In linker.c, load_library(),
> > > it will invoke get_lib_extents() to get from the ELF the mmap_addr,
> > > which should be given in compile time. The code later goes to
> > > alloc_mem_region() which then calls reserve_mem_region() to mmap the
> > > ELF to mmap_addr. If the hint mmap_addr is not used, it simply un-
> > > mapped and returns an error.
>
> > > Why does it return fail instead of using the address provided by mmap?
> > > Why would the mmapping to the given address failed? Low memory? Is it
> > > possible to prevent this problem by remove the library from the
> > > prelink map?
>
> > > Hank
>
> > > On Apr 16, 9:05 pm, Hank <hank.and.gr...@gmail.com> wrote:
>
> > > > Hi group,
>
> > > > I encountered a dlopen() failure and got a message of
> > > > DL_ERR_CANNOT_FIND_LIBRARY. The target library is under /system/lib.
> > > > It is also in the prelink-linux-arm.map. I think low memory might be a
> > > > possibility. Thus, I tried to kill some process to release some
> > > > memory, but the result is the same. I stopped my trace at find_library
> > > > (), linker.c because I can't get log from here and there are several
> > > > possible conditions.
>
> > > > To sum up:
> > > > 1. not because the library is not in the filesystem
> > > > 2. not because of low memory
> > > > 3. not because it is not in the prelink-linux-arm.map
>
> > > > What else can make dlopen() failed?
> > > > Thanks!
>
> > > > Hank
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to