From 6b083889400594b07f7f9f084e3246cd8370e949 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Tue, 18 Jun 2013 23:14:03 +0000 Subject: [yaml2obj][ELF] Rudimentary symbol table support. Currently, we only output the name. llvm-svn: 184255 --- llvm/lib/Object/ELFYAML.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/Object/ELFYAML.cpp') diff --git a/llvm/lib/Object/ELFYAML.cpp b/llvm/lib/Object/ELFYAML.cpp index e0e95bee934..32a759dc0b3 100644 --- a/llvm/lib/Object/ELFYAML.cpp +++ b/llvm/lib/Object/ELFYAML.cpp @@ -260,6 +260,10 @@ void MappingTraits::mapping(IO &IO, IO.mapOptional("Entry", FileHdr.Entry, Hex64(0)); } +void MappingTraits::mapping(IO &IO, ELFYAML::Symbol &Symbol) { + IO.mapOptional("Name", Symbol.Name, StringRef()); +} + void MappingTraits::mapping(IO &IO, ELFYAML::Section &Section) { IO.mapOptional("Name", Section.Name, StringRef()); @@ -269,6 +273,12 @@ void MappingTraits::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::mapping(IO &IO, ELFYAML::Object &Object) { -- cgit v1.2.3