Bug 822584 - Workaround in elfhack to accomodate for breakpad not handling the memory mapping induced by the elfhack/bionic linker combination. r=nfroyd

This commit is contained in:
Mike Hommey
2013-01-02 10:17:32 +01:00
parent b870261a25
commit 943edeb1af
3 changed files with 56 additions and 13 deletions

View File

@@ -585,7 +585,7 @@ void ElfSegment::removeSection(ElfSection *section)
unsigned int ElfSegment::getFileSize()
{
if (type == PT_GNU_RELRO)
if (type == PT_GNU_RELRO || isElfHackFillerSegment())
return filesz;
if (sections.empty())
@@ -604,7 +604,7 @@ unsigned int ElfSegment::getFileSize()
unsigned int ElfSegment::getMemSize()
{
if (type == PT_GNU_RELRO)
if (type == PT_GNU_RELRO || isElfHackFillerSegment())
return memsz;
if (sections.empty())
@@ -621,6 +621,10 @@ unsigned int ElfSegment::getOffset()
(sections.front()->getAddr() != vaddr))
throw std::runtime_error("PT_GNU_RELRO segment doesn't start on a section start");
// Neither bionic nor glibc linkers seem to like when the offset of that segment is 0
if (isElfHackFillerSegment())
return vaddr;
return sections.empty() ? 0 : sections.front()->getOffset();
}
@@ -630,6 +634,9 @@ unsigned int ElfSegment::getAddr()
(sections.front()->getAddr() != vaddr))
throw std::runtime_error("PT_GNU_RELRO segment doesn't start on a section start");
if (isElfHackFillerSegment())
return vaddr;
return sections.empty() ? 0 : sections.front()->getAddr();
}