XCOFFYAML.h 2.1 KB

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