LLVM  14.0.0git
XCOFFYAML.h
Go to the documentation of this file.
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 
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;
25  int32_t TimeStamp;
26  llvm::yaml::Hex64 SymbolTableOffset;
29  llvm::yaml::Hex16 Flags;
30 };
31 
32 struct Relocation {
33  llvm::yaml::Hex64 VirtualAddress;
34  llvm::yaml::Hex64 SymbolIndex;
35  llvm::yaml::Hex8 Info;
36  llvm::yaml::Hex8 Type;
37 };
38 
39 struct Section {
41  llvm::yaml::Hex64 Address;
42  llvm::yaml::Hex64 Size;
43  llvm::yaml::Hex64 FileOffsetToData;
44  llvm::yaml::Hex64 FileOffsetToRelocations;
45  llvm::yaml::Hex64 FileOffsetToLineNumbers; // Line number pointer. Not supported yet.
46  llvm::yaml::Hex16 NumberOfRelocations;
47  llvm::yaml::Hex16 NumberOfLineNumbers; // Line number counts. Not supported yet.
50  std::vector<Relocation> Relocations;
51 };
52 
53 struct Symbol {
55  llvm::yaml::Hex64 Value; // Symbol value; storage class-dependent.
58  llvm::yaml::Hex16 Type;
61 };
62 
63 struct StringTable {
64  Optional<uint32_t> ContentSize; // The total size of the string table.
65  Optional<uint32_t> Length; // The value of the length field for the first
66  // 4 bytes of the table.
69 };
70 
71 struct Object {
73  std::vector<Section> Sections;
74  std::vector<Symbol> Symbols;
76  Object();
77 };
78 } // namespace XCOFFYAML
79 } // namespace llvm
80 
82 LLVM_YAML_IS_SEQUENCE_VECTOR(XCOFFYAML::Relocation)
84 
85 namespace llvm {
86 namespace yaml {
87 
88 template <> struct ScalarBitSetTraits<XCOFF::SectionTypeFlags> {
89  static void bitset(IO &IO, XCOFF::SectionTypeFlags &Value);
90 };
91 
92 template <> struct ScalarEnumerationTraits<XCOFF::StorageClass> {
93  static void enumeration(IO &IO, XCOFF::StorageClass &Value);
94 };
95 
96 template <> struct MappingTraits<XCOFFYAML::FileHeader> {
97  static void mapping(IO &IO, XCOFFYAML::FileHeader &H);
98 };
99 
100 
101 template <> struct MappingTraits<XCOFFYAML::Symbol> {
102  static void mapping(IO &IO, XCOFFYAML::Symbol &S);
103 };
104 
105 template <> struct MappingTraits<XCOFFYAML::Relocation> {
106  static void mapping(IO &IO, XCOFFYAML::Relocation &R);
107 };
108 
109 template <> struct MappingTraits<XCOFFYAML::Section> {
110  static void mapping(IO &IO, XCOFFYAML::Section &Sec);
111 };
112 
113 template <> struct MappingTraits<XCOFFYAML::StringTable> {
114  static void mapping(IO &IO, XCOFFYAML::StringTable &Str);
115 };
116 
117 template <> struct MappingTraits<XCOFFYAML::Object> {
118  static void mapping(IO &IO, XCOFFYAML::Object &Obj);
119 };
120 
121 } // namespace yaml
122 } // namespace llvm
123 
124 #endif // LLVM_OBJECTYAML_XCOFFYAML_H
llvm::XCOFFYAML::Symbol::SectionIndex
Optional< uint16_t > SectionIndex
Definition: XCOFFYAML.h:57
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::XCOFFYAML::FileHeader
Definition: XCOFFYAML.h:22
llvm::XCOFFYAML::Section::FileOffsetToRelocations
llvm::yaml::Hex64 FileOffsetToRelocations
Definition: XCOFFYAML.h:44
llvm::XCOFFYAML::Object::Sections
std::vector< Section > Sections
Definition: XCOFFYAML.h:73
LLVM_YAML_IS_SEQUENCE_VECTOR
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
llvm::XCOFFYAML::FileHeader::Magic
llvm::yaml::Hex16 Magic
Definition: XCOFFYAML.h:23
llvm::XCOFFYAML::Section::FileOffsetToData
llvm::yaml::Hex64 FileOffsetToData
Definition: XCOFFYAML.h:43
llvm::XCOFFYAML::StringTable::Length
Optional< uint32_t > Length
Definition: XCOFFYAML.h:65
llvm::Optional
Definition: APInt.h:33
llvm::XCOFFYAML::Symbol::SectionName
Optional< StringRef > SectionName
Definition: XCOFFYAML.h:56
llvm::XCOFFYAML::Object::StrTbl
StringTable StrTbl
Definition: XCOFFYAML.h:75
llvm::yaml::MappingTraits
Definition: ModuleSummaryIndex.h:52
llvm::XCOFFYAML::Relocation
Definition: XCOFFYAML.h:32
llvm::XCOFFYAML::StringTable
Definition: XCOFFYAML.h:63
llvm::XCOFFYAML::FileHeader::TimeStamp
int32_t TimeStamp
Definition: XCOFFYAML.h:25
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
XCOFF.h
llvm::XCOFFYAML::FileHeader::Flags
llvm::yaml::Hex16 Flags
Definition: XCOFFYAML.h:29
YAML.h
llvm::XCOFFYAML::FileHeader::SymbolTableOffset
llvm::yaml::Hex64 SymbolTableOffset
Definition: XCOFFYAML.h:26
llvm::XCOFFYAML::Symbol::SymbolName
StringRef SymbolName
Definition: XCOFFYAML.h:54
llvm::XCOFFYAML::StringTable::ContentSize
Optional< uint32_t > ContentSize
Definition: XCOFFYAML.h:64
llvm::XCOFFYAML::Section::Flags
uint32_t Flags
Definition: XCOFFYAML.h:48
llvm::XCOFFYAML::StringTable::Strings
Optional< std::vector< StringRef > > Strings
Definition: XCOFFYAML.h:67
llvm::XCOFFYAML::Relocation::VirtualAddress
llvm::yaml::Hex64 VirtualAddress
Definition: XCOFFYAML.h:33
llvm::OutputFileType::Object
@ Object
llvm::XCOFFYAML::Symbol::Type
llvm::yaml::Hex16 Type
Definition: XCOFFYAML.h:58
llvm::XCOFF::StorageClass
StorageClass
Definition: XCOFF.h:113
llvm::XCOFFYAML::FileHeader::NumberOfSections
uint16_t NumberOfSections
Definition: XCOFFYAML.h:24
llvm::XCOFFYAML::Section::NumberOfRelocations
llvm::yaml::Hex16 NumberOfRelocations
Definition: XCOFFYAML.h:46
llvm::XCOFFYAML::Object::Symbols
std::vector< Symbol > Symbols
Definition: XCOFFYAML.h:74
llvm::XCOFFYAML::Object
Definition: XCOFFYAML.h:71
llvm::XCOFFYAML::Symbol::Value
llvm::yaml::Hex64 Value
Definition: XCOFFYAML.h:55
llvm::XCOFFYAML::Relocation::Type
llvm::yaml::Hex8 Type
Definition: XCOFFYAML.h:36
llvm::XCOFFYAML::Section
Definition: XCOFFYAML.h:39
llvm::XCOFFYAML::Relocation::Info
llvm::yaml::Hex8 Info
Definition: XCOFFYAML.h:35
llvm::XCOFFYAML::Object::Object
Object()
Definition: XCOFFYAML.cpp:20
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::yaml::BinaryRef
Specialized YAMLIO scalar type for representing a binary blob.
Definition: YAML.h:63
uint32_t
llvm::XCOFF::SectionTypeFlags
SectionTypeFlags
Definition: XCOFF.h:77
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::XCOFFYAML::Object::Header
FileHeader Header
Definition: XCOFFYAML.h:72
llvm::XCOFFYAML::Section::Size
llvm::yaml::Hex64 Size
Definition: XCOFFYAML.h:42
H
#define H(x, y, z)
Definition: MD5.cpp:58
uint16_t
llvm::XCOFFYAML::Section::FileOffsetToLineNumbers
llvm::yaml::Hex64 FileOffsetToLineNumbers
Definition: XCOFFYAML.h:45
llvm::XCOFFYAML::Symbol::NumberOfAuxEntries
uint8_t NumberOfAuxEntries
Definition: XCOFFYAML.h:60
llvm::ARMBuildAttrs::Symbol
@ Symbol
Definition: ARMBuildAttributes.h:79
llvm::XCOFFYAML::Section::NumberOfLineNumbers
llvm::yaml::Hex16 NumberOfLineNumbers
Definition: XCOFFYAML.h:47
llvm::XCOFFYAML::FileHeader::AuxHeaderSize
uint16_t AuxHeaderSize
Definition: XCOFFYAML.h:28
llvm::XCOFFYAML::Section::Address
llvm::yaml::Hex64 Address
Definition: XCOFFYAML.h:41
llvm::XCOFFYAML::Section::SectionData
yaml::BinaryRef SectionData
Definition: XCOFFYAML.h:49
llvm::XCOFFYAML::FileHeader::NumberOfSymTableEntries
uint32_t NumberOfSymTableEntries
Definition: XCOFFYAML.h:27
llvm::XCOFFYAML::Relocation::SymbolIndex
llvm::yaml::Hex64 SymbolIndex
Definition: XCOFFYAML.h:34
llvm::XCOFFYAML::Section::Relocations
std::vector< Relocation > Relocations
Definition: XCOFFYAML.h:50
llvm::XCOFFYAML::Symbol::StorageClass
XCOFF::StorageClass StorageClass
Definition: XCOFFYAML.h:59
llvm::XCOFFYAML::StringTable::RawContent
Optional< yaml::BinaryRef > RawContent
Definition: XCOFFYAML.h:68
llvm::Value
LLVM Value Representation.
Definition: Value.h:75
llvm::XCOFFYAML::Symbol
Definition: XCOFFYAML.h:53
llvm::XCOFFYAML::Section::SectionName
StringRef SectionName
Definition: XCOFFYAML.h:40