[PATCH] D78627: [obj2yaml] - Zero initialize program headers. NFCI.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 02:06:20 PDT 2020
grimar marked an inline comment as done.
grimar added inline comments.
================
Comment at: llvm/lib/ObjectYAML/ELFEmitter.cpp:764
if (YamlPhdr.Offset) {
- if (!Fragments.empty() && *YamlPhdr.Offset > PhdrFileOffset)
+ if (!Fragments.empty() && *YamlPhdr.Offset > Fragments.front().Offset)
reportError("'Offset' for segment with index " + Twine(PhdrIdx) +
----------------
grimar wrote:
> grimar wrote:
> > jhenderson wrote:
> > > Maybe worth pulling `Fragments.front().Offset` into a variable so that you don't have to repeat its call three times?
> > OK, will do.
> Ah, no, sorry, I can't do it. Otherwise we need to return the following line:
>
> ```
> uint64_t PhdrFileOffset = Fragments.empty() ? 0 : Fragments.front().Offset;
> ```
> i.e. need to check that `Fragments` is not empty again. This is probably a bit more complicated than inlining it.
>
I.e. it would just revert all changes done by this patch here. As an alternative I can abandon this patch and just add `zero(Phdr);` in D78628.
What do you think?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78627/new/
https://reviews.llvm.org/D78627
More information about the llvm-commits
mailing list