MCXCOFFObjectWriter.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/MC/MCXCOFFObjectWriter.h - XCOFF Object Writer ---------------===//
  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. #ifndef LLVM_MC_MCXCOFFOBJECTWRITER_H
  14. #define LLVM_MC_MCXCOFFOBJECTWRITER_H
  15. #include "llvm/MC/MCObjectWriter.h"
  16. namespace llvm {
  17. class raw_pwrite_stream;
  18. class MCXCOFFObjectTargetWriter : public MCObjectTargetWriter {
  19. protected:
  20. MCXCOFFObjectTargetWriter(bool Is64Bit);
  21. public:
  22. ~MCXCOFFObjectTargetWriter() override;
  23. Triple::ObjectFormatType getFormat() const override { return Triple::XCOFF; }
  24. static bool classof(const MCObjectTargetWriter *W) {
  25. return W->getFormat() == Triple::XCOFF;
  26. }
  27. bool is64Bit() const { return Is64Bit; }
  28. // Returns relocation info such as type, sign and size.
  29. // First element of the pair contains type,
  30. // second element contains sign and size.
  31. virtual std::pair<uint8_t, uint8_t>
  32. getRelocTypeAndSignSize(const MCValue &Target, const MCFixup &Fixup,
  33. bool IsPCRel) const = 0;
  34. private:
  35. bool Is64Bit;
  36. };
  37. std::unique_ptr<MCObjectWriter>
  38. createXCOFFObjectWriter(std::unique_ptr<MCXCOFFObjectTargetWriter> MOTW,
  39. raw_pwrite_stream &OS);
  40. } // end namespace llvm
  41. #endif // LLVM_MC_MCXCOFFOBJECTWRITER_H
  42. #ifdef __GNUC__
  43. #pragma GCC diagnostic pop
  44. #endif