summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ObjectYAML
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-05-07 12:10:51 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-05-07 12:10:51 +0000
commit0974688a42c9c605b91bf4b8bfa2baa26d3b180e (patch)
tree48675b1bb685300739fa94c0997ea1cbabf28338 /llvm/lib/ObjectYAML
parent866e05f0234636b5a7546d1be8b1c3ed28ccc654 (diff)
downloadbcm5719-llvm-0974688a42c9c605b91bf4b8bfa2baa26d3b180e.tar.gz
bcm5719-llvm-0974688a42c9c605b91bf4b8bfa2baa26d3b180e.zip
[yaml2obj] - Allow setting st_value explicitly for Symbol.
In some cases it is useful to explicitly set symbol's st_name value. For example, I am using it in a patch for LLD to remove the broken binary from a test case and replace it with a YAML test. Differential revision: https://reviews.llvm.org/D61180 llvm-svn: 360137
Diffstat (limited to 'llvm/lib/ObjectYAML')
-rw-r--r--llvm/lib/ObjectYAML/ELFYAML.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 93d309cdc05..1ac624fe958 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -854,6 +854,7 @@ struct NormalizedOther {
void MappingTraits<ELFYAML::Symbol>::mapping(IO &IO, ELFYAML::Symbol &Symbol) {
IO.mapOptional("Name", Symbol.Name, StringRef());
+ IO.mapOptional("NameIndex", Symbol.NameIndex);
IO.mapOptional("Type", Symbol.Type, ELFYAML::ELF_STT(0));
IO.mapOptional("Section", Symbol.Section, StringRef());
IO.mapOptional("Index", Symbol.Index);
@@ -867,12 +868,12 @@ void MappingTraits<ELFYAML::Symbol>::mapping(IO &IO, ELFYAML::Symbol &Symbol) {
StringRef MappingTraits<ELFYAML::Symbol>::validate(IO &IO,
ELFYAML::Symbol &Symbol) {
- if (Symbol.Index && Symbol.Section.data()) {
+ if (Symbol.Index && Symbol.Section.data())
return "Index and Section cannot both be specified for Symbol";
- }
- if (Symbol.Index && *Symbol.Index == ELFYAML::ELF_SHN(ELF::SHN_XINDEX)) {
+ if (Symbol.Index && *Symbol.Index == ELFYAML::ELF_SHN(ELF::SHN_XINDEX))
return "Large indexes are not supported";
- }
+ if (Symbol.NameIndex && !Symbol.Name.empty())
+ return "Name and NameIndex cannot both be specified for Symbol";
return StringRef();
}
OpenPOWER on IntegriCloud