diff options
author | James Henderson <jh7370@my.bristol.ac.uk> | 2019-02-21 10:57:15 +0000 |
---|---|---|
committer | James Henderson <jh7370@my.bristol.ac.uk> | 2019-02-21 10:57:15 +0000 |
commit | 67bdfb0a5973aa15c977747b1cae10b8d883fe44 (patch) | |
tree | 8d6c7873dc54654c5d0327246b1f21736f406169 /llvm/lib | |
parent | 8ac2b181a1ee4e9f13c23341a391f50324cc9f3d (diff) | |
download | bcm5719-llvm-67bdfb0a5973aa15c977747b1cae10b8d883fe44.tar.gz bcm5719-llvm-67bdfb0a5973aa15c977747b1cae10b8d883fe44.zip |
[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
llvm-svn: 354566
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/ObjectYAML/ELFYAML.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index d709f997966..3eac787a728 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -832,9 +832,6 @@ StringRef MappingTraits<ELFYAML::Symbol>::validate(IO &IO, if (Symbol.Index && *Symbol.Index == ELFYAML::ELF_SHN(ELF::SHN_XINDEX)) { return "Large indexes are not supported"; } - if (Symbol.Index && *Symbol.Index < ELFYAML::ELF_SHN(ELF::SHN_LORESERVE)) { - return "Use a section name to define which section a symbol is defined in"; - } return StringRef(); } |