From 0b28fdb556336e214dd223695ab5f79e02773843 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Thu, 3 Feb 2011 12:10:02 -0500 Subject: [PATCH] Bug 606194 - Use mmap given addresses if necessary, r=taras a=blocking-fennec --- other-licenses/android/linker.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/other-licenses/android/linker.c b/other-licenses/android/linker.c index ad1560e3b17..8e1d44140e5 100644 --- a/other-licenses/android/linker.c +++ b/other-licenses/android/linker.c @@ -828,6 +828,11 @@ get_lib_extents(int fd, const char *name, void *__hdr, unsigned *total_sz) static int reserve_mem_region(soinfo *si) { +#ifdef MOZ_LINKER + static int mapping_collision = 0; + if (mapping_collision) + si->base = NULL; +#endif void *base = mmap((void *)si->base, si->size, PROT_READ | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (base == MAP_FAILED) { @@ -837,11 +842,16 @@ static int reserve_mem_region(soinfo *si) errno, strerror(errno)); return -1; } else if (base != (void *)si->base) { +#ifdef MOZ_LINKER + mapping_collision = 1; + si->base = base; +#else DL_ERR("OOPS: %5d %sprelinked library '%s' mapped at 0x%08x, " "not at 0x%08x", pid, (si->ba_index < 0 ? "" : "non-"), si->name, (unsigned)base, si->base); munmap(base, si->size); return -1; +#endif } return 0; }