]> granicus.if.org Git - llvm/commit
[yaml2obj]Allow symbol Index field to take values lower than SHN_LORESERVE
authorJames Henderson <jh7370@my.bristol.ac.uk>
Thu, 21 Feb 2019 10:57:15 +0000 (10:57 +0000)
committerJames Henderson <jh7370@my.bristol.ac.uk>
Thu, 21 Feb 2019 10:57:15 +0000 (10:57 +0000)
commitbf5066713acb561e5b357d60d00997d89d55621b
tree3b5f86d3b6ce3668e423915e2845161801edce1e
parent1ccbb08e460dd92ce7be16ea97459ae9032c8217
[yaml2obj]Allow symbol Index field to take values lower than SHN_LORESERVE

In order to test tool handling of invalid section indexes, I need to
create an object containing such an invalid section index. I could
create a hex-edited binary, but having the ability to use yaml2obj is
preferable. Prior to this change, yaml2obj would reject any explicit
section indexes less than SHN_LORESERVE. This patch changes it to allow
any value.

I had to change the test to use llvm-readelf instead of llvm-readobj,
because llvm-readobj does not like invalid section indexes. I've also
expanded the test to show that the most common SHN_* values are accepted
(SHN_UNDEF, SHN_ABS, SHN_COMMON).

Reviewed by: grimar, jakehehrlich

Differential Revision: https://reviews.llvm.org/D58445

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354566 91177308-0d34-0410-b5e6-96231b3b80d8
lib/ObjectYAML/ELFYAML.cpp
test/tools/yaml2obj/symbol-index.yaml