diff options
Diffstat (limited to 'include/llvm/ObjectYAML')
| -rw-r--r-- | include/llvm/ObjectYAML/COFFYAML.h | 1 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h | 6 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/CodeViewYAMLTypes.h | 6 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/DWARFEmitter.h | 7 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/DWARFYAML.h | 2 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/ELFYAML.h | 2 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/MachOYAML.h | 2 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/WasmYAML.h | 53 | ||||
| -rw-r--r-- | include/llvm/ObjectYAML/YAML.h | 12 |
9 files changed, 67 insertions, 24 deletions
diff --git a/include/llvm/ObjectYAML/COFFYAML.h b/include/llvm/ObjectYAML/COFFYAML.h index 8794eaa6d59a..78f021fc0386 100644 --- a/include/llvm/ObjectYAML/COFFYAML.h +++ b/include/llvm/ObjectYAML/COFFYAML.h @@ -67,6 +67,7 @@ struct Section { yaml::BinaryRef SectionData; std::vector<CodeViewYAML::YAMLDebugSubsection> DebugS; std::vector<CodeViewYAML::LeafRecord> DebugT; + std::vector<CodeViewYAML::LeafRecord> DebugP; Optional<CodeViewYAML::DebugHSection> DebugH; std::vector<Relocation> Relocations; StringRef Name; diff --git a/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h b/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h index 4f0d9efb963b..344966fe6891 100644 --- a/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h +++ b/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h @@ -32,10 +32,10 @@ namespace CodeViewYAML { struct GlobalHash { GlobalHash() = default; explicit GlobalHash(StringRef S) : Hash(S) { - assert(S.size() == 20 && "Invalid hash size!"); + assert(S.size() == 8 && "Invalid hash size!"); } explicit GlobalHash(ArrayRef<uint8_t> S) : Hash(S) { - assert(S.size() == 20 && "Invalid hash size!"); + assert(S.size() == 8 && "Invalid hash size!"); } yaml::BinaryRef Hash; }; @@ -47,7 +47,7 @@ struct DebugHSection { std::vector<GlobalHash> Hashes; }; -DebugHSection fromDebugH(ArrayRef<uint8_t> DebugT); +DebugHSection fromDebugH(ArrayRef<uint8_t> DebugH); ArrayRef<uint8_t> toDebugH(const DebugHSection &DebugH, BumpPtrAllocator &Alloc); diff --git a/include/llvm/ObjectYAML/CodeViewYAMLTypes.h b/include/llvm/ObjectYAML/CodeViewYAMLTypes.h index bc3b5567c2f9..1b1306df4f53 100644 --- a/include/llvm/ObjectYAML/CodeViewYAMLTypes.h +++ b/include/llvm/ObjectYAML/CodeViewYAMLTypes.h @@ -51,8 +51,10 @@ struct LeafRecord { static Expected<LeafRecord> fromCodeViewRecord(codeview::CVType Type); }; -std::vector<LeafRecord> fromDebugT(ArrayRef<uint8_t> DebugT); -ArrayRef<uint8_t> toDebugT(ArrayRef<LeafRecord>, BumpPtrAllocator &Alloc); +std::vector<LeafRecord> fromDebugT(ArrayRef<uint8_t> DebugTorP, + StringRef SectionName); +ArrayRef<uint8_t> toDebugT(ArrayRef<LeafRecord>, BumpPtrAllocator &Alloc, + StringRef SectionName); } // end namespace CodeViewYAML diff --git a/include/llvm/ObjectYAML/DWARFEmitter.h b/include/llvm/ObjectYAML/DWARFEmitter.h index 0d7d8b4efbdf..ce3227421930 100644 --- a/include/llvm/ObjectYAML/DWARFEmitter.h +++ b/include/llvm/ObjectYAML/DWARFEmitter.h @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// /// \file -/// \brief Common declarations for yaml2obj +/// Common declarations for yaml2obj //===----------------------------------------------------------------------===// #ifndef LLVM_OBJECTYAML_DWARFEMITTER_H @@ -39,11 +39,12 @@ void EmitDebugInfo(raw_ostream &OS, const Data &DI); void EmitDebugLine(raw_ostream &OS, const Data &DI); Expected<StringMap<std::unique_ptr<MemoryBuffer>>> -EmitDebugSections(StringRef YAMLString, +EmitDebugSections(StringRef YAMLString, bool ApplyFixups = false, bool IsLittleEndian = sys::IsLittleEndianHost); +StringMap<std::unique_ptr<MemoryBuffer>> +EmitDebugSections(llvm::DWARFYAML::Data &DI, bool ApplyFixups); } // end namespace DWARFYAML - } // end namespace llvm #endif // LLVM_OBJECTYAML_DWARFEMITTER_H diff --git a/include/llvm/ObjectYAML/DWARFYAML.h b/include/llvm/ObjectYAML/DWARFYAML.h index 2162f0fef852..705c88778945 100644 --- a/include/llvm/ObjectYAML/DWARFYAML.h +++ b/include/llvm/ObjectYAML/DWARFYAML.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares classes for handling the YAML representation +/// This file declares classes for handling the YAML representation /// of DWARF Debug Info. /// //===----------------------------------------------------------------------===// diff --git a/include/llvm/ObjectYAML/ELFYAML.h b/include/llvm/ObjectYAML/ELFYAML.h index 7ba83967330e..6fc69735f1c7 100644 --- a/include/llvm/ObjectYAML/ELFYAML.h +++ b/include/llvm/ObjectYAML/ELFYAML.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares classes for handling the YAML representation +/// This file declares classes for handling the YAML representation /// of ELF. /// //===----------------------------------------------------------------------===// diff --git a/include/llvm/ObjectYAML/MachOYAML.h b/include/llvm/ObjectYAML/MachOYAML.h index 1fa8f92e516a..cec4f86185f0 100644 --- a/include/llvm/ObjectYAML/MachOYAML.h +++ b/include/llvm/ObjectYAML/MachOYAML.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares classes for handling the YAML representation +/// This file declares classes for handling the YAML representation /// of Mach-O. /// //===----------------------------------------------------------------------===// diff --git a/include/llvm/ObjectYAML/WasmYAML.h b/include/llvm/ObjectYAML/WasmYAML.h index 188ce8e44491..8cd08e520560 100644 --- a/include/llvm/ObjectYAML/WasmYAML.h +++ b/include/llvm/ObjectYAML/WasmYAML.h @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file declares classes for handling the YAML representation +/// This file declares classes for handling the YAML representation /// of wasm binaries. /// //===----------------------------------------------------------------------===// @@ -28,15 +28,17 @@ namespace llvm { namespace WasmYAML { LLVM_YAML_STRONG_TYPEDEF(uint32_t, SectionType) -LLVM_YAML_STRONG_TYPEDEF(int32_t, ValueType) -LLVM_YAML_STRONG_TYPEDEF(int32_t, TableType) -LLVM_YAML_STRONG_TYPEDEF(int32_t, SignatureForm) +LLVM_YAML_STRONG_TYPEDEF(uint32_t, ValueType) +LLVM_YAML_STRONG_TYPEDEF(uint32_t, TableType) +LLVM_YAML_STRONG_TYPEDEF(uint32_t, SignatureForm) LLVM_YAML_STRONG_TYPEDEF(uint32_t, ExportKind) LLVM_YAML_STRONG_TYPEDEF(uint32_t, Opcode) LLVM_YAML_STRONG_TYPEDEF(uint32_t, RelocType) LLVM_YAML_STRONG_TYPEDEF(uint32_t, SymbolFlags) +LLVM_YAML_STRONG_TYPEDEF(uint32_t, SymbolKind) LLVM_YAML_STRONG_TYPEDEF(uint32_t, SegmentFlags) LLVM_YAML_STRONG_TYPEDEF(uint32_t, LimitFlags) +LLVM_YAML_STRONG_TYPEDEF(uint32_t, ComdatKind) struct FileHeader { yaml::Hex32 Version; @@ -66,6 +68,7 @@ struct ElemSegment { }; struct Global { + uint32_t Index; ValueType Type; bool Mutable; wasm::WasmInitExpr InitExpr; @@ -89,6 +92,7 @@ struct LocalDecl { }; struct Function { + uint32_t Index; std::vector<LocalDecl> Locals; yaml::BinaryRef Body; }; @@ -127,13 +131,29 @@ struct Signature { }; struct SymbolInfo { + uint32_t Index; StringRef Name; + SymbolKind Kind; SymbolFlags Flags; + union { + uint32_t ElementIndex; + wasm::WasmDataReference DataRef; + }; }; struct InitFunction { uint32_t Priority; - uint32_t FunctionIndex; + uint32_t Symbol; +}; + +struct ComdatEntry { + ComdatKind Kind; + uint32_t Index; +}; + +struct Comdat { + StringRef Name; + std::vector<ComdatEntry> Entries; }; struct Section { @@ -175,10 +195,11 @@ struct LinkingSection : CustomSection { return C && C->Name == "linking"; } - uint32_t DataSize; - std::vector<SymbolInfo> SymbolInfos; + uint32_t Version; + std::vector<SymbolInfo> SymbolTable; std::vector<SegmentInfo> SegmentInfos; std::vector<InitFunction> InitFunctions; + std::vector<Comdat> Comdats; }; struct TypeSection : Section { @@ -316,6 +337,8 @@ LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::NameEntry) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SegmentInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::SymbolInfo) LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::InitFunction) +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::ComdatEntry) +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::WasmYAML::Comdat) namespace llvm { namespace yaml { @@ -352,6 +375,10 @@ template <> struct ScalarBitSetTraits<WasmYAML::SymbolFlags> { static void bitset(IO &IO, WasmYAML::SymbolFlags &Value); }; +template <> struct ScalarEnumerationTraits<WasmYAML::SymbolKind> { + static void enumeration(IO &IO, WasmYAML::SymbolKind &Kind); +}; + template <> struct ScalarBitSetTraits<WasmYAML::SegmentFlags> { static void bitset(IO &IO, WasmYAML::SegmentFlags &Value); }; @@ -412,6 +439,18 @@ template <> struct MappingTraits<WasmYAML::InitFunction> { static void mapping(IO &IO, WasmYAML::InitFunction &Init); }; +template <> struct ScalarEnumerationTraits<WasmYAML::ComdatKind> { + static void enumeration(IO &IO, WasmYAML::ComdatKind &Kind); +}; + +template <> struct MappingTraits<WasmYAML::ComdatEntry> { + static void mapping(IO &IO, WasmYAML::ComdatEntry &ComdatEntry); +}; + +template <> struct MappingTraits<WasmYAML::Comdat> { + static void mapping(IO &IO, WasmYAML::Comdat &Comdat); +}; + template <> struct ScalarEnumerationTraits<WasmYAML::ValueType> { static void enumeration(IO &IO, WasmYAML::ValueType &Type); }; diff --git a/include/llvm/ObjectYAML/YAML.h b/include/llvm/ObjectYAML/YAML.h index 93266dd67f1a..163cd8dfcf08 100644 --- a/include/llvm/ObjectYAML/YAML.h +++ b/include/llvm/ObjectYAML/YAML.h @@ -21,7 +21,7 @@ class raw_ostream; namespace yaml { -/// \brief Specialized YAMLIO scalar type for representing a binary blob. +/// Specialized YAMLIO scalar type for representing a binary blob. /// /// A typical use case would be to represent the content of a section in a /// binary file. @@ -64,11 +64,11 @@ namespace yaml { class BinaryRef { friend bool operator==(const BinaryRef &LHS, const BinaryRef &RHS); - /// \brief Either raw binary data, or a string of hex bytes (must always + /// Either raw binary data, or a string of hex bytes (must always /// be an even number of characters). ArrayRef<uint8_t> Data; - /// \brief Discriminator between the two states of the `Data` member. + /// Discriminator between the two states of the `Data` member. bool DataIsHexString = true; public: @@ -77,7 +77,7 @@ public: BinaryRef(StringRef Data) : Data(reinterpret_cast<const uint8_t *>(Data.data()), Data.size()) {} - /// \brief The number of bytes that are represented by this BinaryRef. + /// The number of bytes that are represented by this BinaryRef. /// This is the number of bytes that writeAsBinary() will write. ArrayRef<uint8_t>::size_type binary_size() const { if (DataIsHexString) @@ -85,11 +85,11 @@ public: return Data.size(); } - /// \brief Write the contents (regardless of whether it is binary or a + /// Write the contents (regardless of whether it is binary or a /// hex string) as binary to the given raw_ostream. void writeAsBinary(raw_ostream &OS) const; - /// \brief Write the contents (regardless of whether it is binary or a + /// Write the contents (regardless of whether it is binary or a /// hex string) as hex to the given raw_ostream. /// /// For example, a possible output could be `DEADBEEFCAFEBABE`. |
