1 //===----- XCOFFYAML.h - XCOFF YAMLIO implementation ------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file declares classes for handling the YAML representation of XCOFF. 10 // 11 //===----------------------------------------------------------------------===// 12 #ifndef LLVM_OBJECTYAML_XCOFFYAML_H 13 #define LLVM_OBJECTYAML_XCOFFYAML_H 14 15 #include "llvm/BinaryFormat/XCOFF.h" 16 #include "llvm/ObjectYAML/YAML.h" 17 #include <vector> 18 19 namespace llvm { 20 namespace XCOFFYAML { 21 22 struct FileHeader { 23 llvm::yaml::Hex16 Magic; 24 uint16_t NumberOfSections; 25 int32_t TimeStamp; 26 llvm::yaml::Hex32 SymbolTableOffset; // File offset to symbol table. 27 int32_t NumberOfSymTableEntries; 28 uint16_t AuxHeaderSize; 29 llvm::yaml::Hex16 Flags; 30 }; 31 32 struct Symbol { 33 StringRef SymbolName; 34 llvm::yaml::Hex32 Value; // Symbol value; storage class-dependent. 35 StringRef SectionName; 36 llvm::yaml::Hex16 Type; 37 XCOFF::StorageClass StorageClass; 38 uint8_t NumberOfAuxEntries; // Number of auxiliary entries 39 }; 40 41 struct Object { 42 FileHeader Header; 43 std::vector<Symbol> Symbols; 44 Object(); 45 }; 46 } // namespace XCOFFYAML 47 } // namespace llvm 48 LLVM_YAML_IS_SEQUENCE_VECTOR(XCOFFYAML::Symbol) 49 namespace llvm { 50 namespace yaml { 51 52 template <> struct ScalarEnumerationTraits<XCOFF::StorageClass> { 53 static void enumeration(IO &IO, XCOFF::StorageClass &Value); 54 }; 55 56 template <> struct MappingTraits<XCOFFYAML::FileHeader> { 57 static void mapping(IO &IO, XCOFFYAML::FileHeader &H); 58 }; 59 60 template <> struct MappingTraits<XCOFFYAML::Object> { 61 static void mapping(IO &IO, XCOFFYAML::Object &Obj); 62 }; 63 64 template <> struct MappingTraits<XCOFFYAML::Symbol> { 65 static void mapping(IO &IO, XCOFFYAML::Symbol &S); 66 }; 67 68 } // namespace yaml 69 } // namespace llvm 70 71 #endif // LLVM_OBJECTYAML_XCOFFYAML_H 72