am f5f29de6: Merge "Fix bionic linker to support segments with zero p_filesz"
* commit 'f5f29de6ae5a0b74234f111b5691a1e5588671cb': Fix bionic linker to support segments with zero p_filesz
This commit is contained in:
commit
46bf467a15
@ -320,16 +320,19 @@ bool ElfReader::LoadSegments() {
|
|||||||
Elf32_Addr file_end = file_start + phdr->p_filesz;
|
Elf32_Addr file_end = file_start + phdr->p_filesz;
|
||||||
|
|
||||||
Elf32_Addr file_page_start = PAGE_START(file_start);
|
Elf32_Addr file_page_start = PAGE_START(file_start);
|
||||||
|
Elf32_Addr file_length = file_end - file_page_start;
|
||||||
|
|
||||||
void* seg_addr = mmap((void*)seg_page_start,
|
if (file_length != 0) {
|
||||||
file_end - file_page_start,
|
void* seg_addr = mmap((void*)seg_page_start,
|
||||||
PFLAGS_TO_PROT(phdr->p_flags),
|
file_length,
|
||||||
MAP_FIXED|MAP_PRIVATE,
|
PFLAGS_TO_PROT(phdr->p_flags),
|
||||||
fd_,
|
MAP_FIXED|MAP_PRIVATE,
|
||||||
file_page_start);
|
fd_,
|
||||||
if (seg_addr == MAP_FAILED) {
|
file_page_start);
|
||||||
DL_ERR("couldn't map \"%s\" segment %d: %s", name_, i, strerror(errno));
|
if (seg_addr == MAP_FAILED) {
|
||||||
return false;
|
DL_ERR("couldn't map \"%s\" segment %d: %s", name_, i, strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the segment is writable, and does not end on a page boundary,
|
// if the segment is writable, and does not end on a page boundary,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user