OSDN Git Service

[yaml2obj] - Program headers: add an additional check for `Offset`
authorGeorgii Rymar <grimar@accesssoftek.com>
Thu, 16 Apr 2020 13:41:28 +0000 (16:41 +0300)
committerGeorgii Rymar <grimar@accesssoftek.com>
Wed, 22 Apr 2020 09:49:05 +0000 (12:49 +0300)
commit2bf56743172c536b201a6f68b497694253236bd4
treeed562307c5ca5fc39b49e5ae0ba3a778e70c987f
parent87d33d9e09c6b727e108c6cd86b36743740e08cc
[yaml2obj] - Program headers: add an additional check for `Offset`

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 adds tests.

Differential revision: https://reviews.llvm.org/D78304
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/test/Object/invalid.test
llvm/test/tools/llvm-objcopy/ELF/invalid-p_filesz-p_offset.test
llvm/test/tools/llvm-readobj/ELF/gnu-notes.test
llvm/test/tools/yaml2obj/ELF/program-header-size-offset.yaml