diff options
author | Sean Silva <silvas@purdue.edu> | 2013-06-22 01:38:00 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2013-06-22 01:38:00 +0000 |
commit | 068463b714bd53fffd41322a5654b4f359c2166c (patch) | |
tree | 78bbe3b036bd29783bed1505bfaab0162b42611d /lib/Object | |
parent | 681dafbb6c605b96b141accf428923076606ec9e (diff) | |
download | external_llvm-068463b714bd53fffd41322a5654b4f359c2166c.zip external_llvm-068463b714bd53fffd41322a5654b4f359c2166c.tar.gz external_llvm-068463b714bd53fffd41322a5654b4f359c2166c.tar.bz2 |
[yaml2obj][ELF] Make symbol table top-level key.
Although in reality the symbol table in ELF resides in a section, the
standard requires that there be no more than one SHT_SYMTAB. To enforce
this constraint, it is cleaner to group all the symbols under a
top-level `Symbols` key on the object file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184627 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/ELFYAML.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Object/ELFYAML.cpp b/lib/Object/ELFYAML.cpp index 107333c..a331302 100644 --- a/lib/Object/ELFYAML.cpp +++ b/lib/Object/ELFYAML.cpp @@ -244,7 +244,8 @@ void ScalarEnumerationTraits<ELFYAML::ELF_SHT>::enumeration( #define ECase(X) IO.enumCase(Value, #X, ELF::X); ECase(SHT_NULL) ECase(SHT_PROGBITS) - ECase(SHT_SYMTAB) + // No SHT_SYMTAB. Use the top-level `Symbols` key instead. + // FIXME: Issue a diagnostic with this information. ECase(SHT_STRTAB) ECase(SHT_RELA) ECase(SHT_HASH) @@ -326,17 +327,12 @@ void MappingTraits<ELFYAML::Section>::mapping(IO &IO, IO.mapOptional("Content", Section.Content); IO.mapOptional("Link", Section.Link); IO.mapOptional("AddressAlign", Section.AddressAlign, Hex64(0)); - // TODO: Error if `Type` is SHT_SYMTAB and this is not present, or if - // `Type` is *not* SHT_SYMTAB and this *is* present. (By SHT_SYMTAB I - // also mean SHT_DYNSYM, but for simplicity right now we just do - // SHT_SYMTAB). Want to be able to share the predicate with consumers of - // this structure. - IO.mapOptional("Symbols", Section.Symbols); } void MappingTraits<ELFYAML::Object>::mapping(IO &IO, ELFYAML::Object &Object) { IO.mapRequired("FileHeader", Object.Header); IO.mapOptional("Sections", Object.Sections); + IO.mapOptional("Symbols", Object.Symbols); } } // end namespace yaml |