diff options
author | Sean Silva <silvas@purdue.edu> | 2013-06-21 00:27:50 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2013-06-21 00:27:50 +0000 |
commit | 4235ba32f2610ee2ed1e0c4bfca5c67835e9f97d (patch) | |
tree | aa2148433b9e8a6d81ca6e871f18f1122e1bfd45 /lib/Object | |
parent | 2b7cdf09a142b7f3e9a0ec8c7044eaf89bc59caa (diff) | |
download | external_llvm-4235ba32f2610ee2ed1e0c4bfca5c67835e9f97d.zip external_llvm-4235ba32f2610ee2ed1e0c4bfca5c67835e9f97d.tar.gz external_llvm-4235ba32f2610ee2ed1e0c4bfca5c67835e9f97d.tar.bz2 |
[yaml2obj][ELF] Don't explicitly set `Binding` with STB_*
Instead, just have 3 sub-lists, one for each of
{STB_LOCAL,STB_GLOBAL,STB_WEAK}.
This allows us to be a lot more explicit w.r.t. the symbol ordering in
the object file, because if we allowed explicitly setting the STB_*
`Binding` key for the symbol, then we might have ended up having to
shuffle STB_LOCAL symbols to the front of the list, which is likely to
cause confusion and potential for error.
Also, this new approach is simpler ;)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184506 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/ELFYAML.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Object/ELFYAML.cpp b/lib/Object/ELFYAML.cpp index 7fa7756..107333c 100644 --- a/lib/Object/ELFYAML.cpp +++ b/lib/Object/ELFYAML.cpp @@ -278,15 +278,6 @@ void ScalarBitSetTraits<ELFYAML::ELF_SHF>::bitset(IO &IO, #undef BCase } -void ScalarEnumerationTraits<ELFYAML::ELF_STB>::enumeration( - IO &IO, ELFYAML::ELF_STB &Value) { -#define ECase(X) IO.enumCase(Value, #X, ELF::X); - ECase(STB_LOCAL) - ECase(STB_GLOBAL) - ECase(STB_WEAK) -#undef ECase -} - void ScalarEnumerationTraits<ELFYAML::ELF_STT>::enumeration( IO &IO, ELFYAML::ELF_STT &Value) { #define ECase(X) IO.enumCase(Value, #X, ELF::X); @@ -313,13 +304,19 @@ void MappingTraits<ELFYAML::FileHeader>::mapping(IO &IO, void MappingTraits<ELFYAML::Symbol>::mapping(IO &IO, ELFYAML::Symbol &Symbol) { IO.mapOptional("Name", Symbol.Name, StringRef()); - IO.mapOptional("Binding", Symbol.Binding, ELFYAML::ELF_STB(0)); IO.mapOptional("Type", Symbol.Type, ELFYAML::ELF_STT(0)); IO.mapOptional("Section", Symbol.Section, StringRef()); IO.mapOptional("Value", Symbol.Value, Hex64(0)); IO.mapOptional("Size", Symbol.Size, Hex64(0)); } +void MappingTraits<ELFYAML::LocalGlobalWeakSymbols>::mapping( + IO &IO, ELFYAML::LocalGlobalWeakSymbols &Symbols) { + IO.mapOptional("Local", Symbols.Local); + IO.mapOptional("Global", Symbols.Global); + IO.mapOptional("Weak", Symbols.Weak); +} + void MappingTraits<ELFYAML::Section>::mapping(IO &IO, ELFYAML::Section &Section) { IO.mapOptional("Name", Section.Name, StringRef()); |