[obj2yaml] - Program headers: simplify the computation of p_filesz.
authorGeorgii Rymar <grimar@accesssoftek.com>
Wed, 22 Apr 2020 11:00:33 +0000 (14:00 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Fri, 24 Apr 2020 12:23:16 +0000 (15:23 +0300)
commit9f9a08e19c4b617d7d77754a8ebc2a0169760df5
treec6b979140ed6ec0ffdf4bae92ef8a5416f8bbebe
parent1ccfe475a753a93d647be78edff000b9d6667ff7
[obj2yaml] - Program headers: simplify the computation of p_filesz.

Currently we have computations of `p_filesz` and `p_memsz` mixed together
with the use of a loop over fragments. After recent changes it is possible to
avoid using a loop for the computation of `p_filesz`, since we know that fragments
are sorted by their file offsets.

The main benefit of this change is that splits the computation of `p_filesz`
and `p_memsz` what is simpler and allows us to fix the computation of the
`p_memsz` independently (D78005 shows the issue that we have currently).

Differential revision: https://reviews.llvm.org/D78628
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml