Bug 1491140 - Count non-elfhacked relocations size when comparing to original size r=froydnj

When checking whether the new relocations sizes are going to be a win, we
need to account for the fact that there are non-elfhacked relocation
remaining.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2018-09-14 13:16:25 +00:00
Родитель 682d2bd651
Коммит 9f4a67977e
1 изменённых файлов: 1 добавлений и 1 удалений

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

@ -1083,7 +1083,7 @@ int do_relocation_section(Elf *elf, unsigned int rel_type, unsigned int rel_type
// code section, so the overhead of the page alignment for section needs to be
// accounted for.
size_t align = first_executable->getSegmentByType(PT_LOAD)->getAlign();
size_t new_size = relhack->getSize() + relhackcode->getSize() + (relhackcode->getAddr() & (align - 1));
size_t new_size = relhack->getSize() + section->getSize() + relhackcode->getSize() + (relhackcode->getAddr() & (align - 1));
if (!force && (new_size >= old_size || old_size - new_size < align)) {
fprintf(stderr, "No gain. Skipping\n");
return -1;