XCOFFWriter.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===- XCOFFWriter.h --------------------------------------------*- 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. #ifndef LLVM_LIB_OBJCOPY_XCOFF_XCOFFWRITER_H
  9. #define LLVM_LIB_OBJCOPY_XCOFF_XCOFFWRITER_H
  10. #include "llvm/Support/MemoryBuffer.h"
  11. #include "XCOFFObject.h"
  12. #include <cstdint>
  13. #include <vector>
  14. namespace llvm {
  15. namespace objcopy {
  16. namespace xcoff {
  17. class XCOFFWriter {
  18. public:
  19. virtual ~XCOFFWriter() {}
  20. XCOFFWriter(Object &Obj, raw_ostream &Out) : Obj(Obj), Out(Out) {}
  21. Error write();
  22. private:
  23. Object &Obj;
  24. raw_ostream &Out;
  25. std::unique_ptr<WritableMemoryBuffer> Buf;
  26. size_t FileSize;
  27. void finalizeHeaders();
  28. void finalizeSections();
  29. void finalizeSymbolStringTable();
  30. void finalize();
  31. void writeHeaders();
  32. void writeSections();
  33. void writeSymbolStringTable();
  34. };
  35. } // end namespace xcoff
  36. } // end namespace objcopy
  37. } // end namespace llvm
  38. #endif // LLVM_LIB_OBJCOPY_XCOFF_XCOFFWRITER_H