[PATCH] D78005: [yaml2obj] - Reimplement how tool calculates memory sizes of segments.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 15 10:59:42 PDT 2020
MaskRay added a comment.
for (size_t I = 0, E = Fragments.size(); I != E; ++I) {
const Fragment &Cur = Fragments[I];
const Fragment *Next = (I + 1 < E) ? &Fragments[I + 1] : nullptr;
if (Next)
MemSize += std::max(Next->Offset - Cur.Offset, Cur.Size); ///////////// [1]
else
MemSize += Cur.Size;
}
[1] is probably less than ideal. If a middle section has erroneous large sh_size (for example, due to ShSize:), we may want to ignore it when computing p_memsz.
We probably should ignore sh_offset and use sh_addr when computing p_memsz:
p->p_memsz = last->addr + last->size - first->addr;
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78005/new/
https://reviews.llvm.org/D78005
More information about the llvm-commits
mailing list