Map libraries linked with -Ttext-segment=base_addr at base_addr.

Normal libraries have base address 0 and are unaffected by this change.

PR:		176216
Submitted by:	Damjan Jovanovic <damjan.jov@gmail.com>
Reviewed by:	kib
MFC after:	1 week
This commit is contained in:
tijl 2013-02-27 09:34:09 +00:00
parent 5f76bacc85
commit 1378fd6863

View File

@ -175,7 +175,7 @@ map_object(int fd, const char *path, const struct stat *sb)
base_vaddr = trunc_page(segs[0]->p_vaddr);
base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz);
mapsize = base_vlimit - base_vaddr;
base_addr = hdr->e_type == ET_EXEC ? (caddr_t) base_vaddr : NULL;
base_addr = (caddr_t) base_vaddr;
mapbase = mmap(base_addr, mapsize, PROT_NONE, MAP_ANON | MAP_PRIVATE |
MAP_NOCORE, -1, 0);