Merge "linker: mark library .bss pages with anon:.bss"

am: 0e915b294b

* commit '0e915b294b2b1f0d20cd1b9a4e1721d59ccbfa7a':
  linker: mark library .bss pages with anon:.bss
This commit is contained in:
Dimitry Ivanov 2016-01-28 03:54:26 +00:00 committed by android-build-merger
commit 2c1589f568

View file

@ -39,6 +39,8 @@
#include "linker_debug.h"
#include "linker_utils.h"
#include "private/bionic_prctl.h"
static int GetTargetElfMachine() {
#if defined(__arm__)
return EM_ARM;
@ -540,8 +542,9 @@ bool ElfReader::LoadSegments() {
// between them. This is done by using a private anonymous
// map for all extra pages.
if (seg_page_end > seg_file_end) {
size_t zeromap_size = seg_page_end - seg_file_end;
void* zeromap = mmap(reinterpret_cast<void*>(seg_file_end),
seg_page_end - seg_file_end,
zeromap_size,
PFLAGS_TO_PROT(phdr->p_flags),
MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE,
-1,
@ -550,6 +553,8 @@ bool ElfReader::LoadSegments() {
DL_ERR("couldn't zero fill \"%s\" gap: %s", name_.c_str(), strerror(errno));
return false;
}
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, zeromap, zeromap_size, ".bss");
}
}
return true;