[PATCH] D78304: [yaml2obj] - Program headers: introduce the `POffset` and add an additional check for `Offset`

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 16 08:54:40 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.

The `Offset` field is used to set the file offset of a program header.
In a normal object it should not be greater than the minimal offset
of sections included into segment.

This patch adds a check for that and introduces the `POffset` property which
can be used to override the value of p_offset. It is consistent with what
we do for `Section::ShFlags` and similar to other `Sh*` properties we have.


https://reviews.llvm.org/D78304

Files:
  llvm/include/llvm/ObjectYAML/ELFYAML.h
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/Object/invalid.test
  llvm/test/tools/llvm-objcopy/ELF/invalid-p_filesz-p_offset.test
  llvm/test/tools/llvm-objcopy/ELF/only-keep-debug.test
  llvm/test/tools/llvm-objcopy/ELF/overlapping-sections-in-segments.test
  llvm/test/tools/llvm-objcopy/ELF/preserve-segment-contents.test
  llvm/test/tools/llvm-readobj/ELF/gnu-notes.test
  llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78304.258062.patch
Type: text/x-patch
Size: 11557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200416/d16e44f5/attachment-0001.bin>


More information about the llvm-commits mailing list