Bug 1542958 - fix code section adjustments in elfhack; r=glandium

We were never adjusting `last` in this loop, so we were computing the
wrong addresses for all sections beyond the first.  Which in turn meant
that we would compute the wrong size for the section data we needed to
allocate.

Differential Revision: https://phabricator.services.mozilla.com/D28195

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nathan Froyd 2019-04-22 23:44:28 +00:00
Родитель 63c8f7ae98
Коммит 3b7164be54
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -177,6 +177,7 @@ class ElfRelHackCode_Section : public ElfSection {
// alignment required by code sections.
if (shdr.sh_addralign < (*c)->getAddrAlign())
shdr.sh_addralign = (*c)->getAddrAlign();
last = *c;
}
shdr.sh_size = code.back()->getAddr() + code.back()->getSize();
data = static_cast<char *>(malloc(shdr.sh_size));