blob: f99004e69762fe7a199c495d9d4d0b64f0746a3a [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===----- 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
19namespace llvm {
20namespace XCOFFYAML {
21
22struct 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
32struct 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
41struct Object {
42 FileHeader Header;
43 std::vector<Symbol> Symbols;
44 Object();
45};
46} // namespace XCOFFYAML
47} // namespace llvm
48LLVM_YAML_IS_SEQUENCE_VECTOR(XCOFFYAML::Symbol)
49namespace llvm {
50namespace yaml {
51
52template <> struct ScalarEnumerationTraits<XCOFF::StorageClass> {
53 static void enumeration(IO &IO, XCOFF::StorageClass &Value);
54};
55
56template <> struct MappingTraits<XCOFFYAML::FileHeader> {
57 static void mapping(IO &IO, XCOFFYAML::FileHeader &H);
58};
59
60template <> struct MappingTraits<XCOFFYAML::Object> {
61 static void mapping(IO &IO, XCOFFYAML::Object &Obj);
62};
63
64template <> 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