MachO_arm64.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===---- MachO_arm64.h - JIT link functions for MachO/arm64 ----*- 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. // jit-link functions for MachO/arm64.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_JITLINK_MACHO_ARM64_H
  18. #define LLVM_EXECUTIONENGINE_JITLINK_MACHO_ARM64_H
  19. #include "llvm/ExecutionEngine/JITLink/JITLink.h"
  20. namespace llvm {
  21. namespace jitlink {
  22. namespace MachO_arm64_Edges {
  23. enum MachOARM64RelocationKind : Edge::Kind {
  24. Branch26 = Edge::FirstRelocation,
  25. Pointer32,
  26. Pointer64,
  27. Pointer64Anon,
  28. Page21,
  29. PageOffset12,
  30. GOTPage21,
  31. GOTPageOffset12,
  32. TLVPage21,
  33. TLVPageOffset12,
  34. PointerToGOT,
  35. PairedAddend,
  36. LDRLiteral19,
  37. Delta32,
  38. Delta64,
  39. NegDelta32,
  40. NegDelta64,
  41. };
  42. } // namespace MachO_arm64_Edges
  43. /// Create a LinkGraph from a MachO/arm64 relocatable object.
  44. ///
  45. /// Note: The graph does not take ownership of the underlying buffer, nor copy
  46. /// its contents. The caller is responsible for ensuring that the object buffer
  47. /// outlives the graph.
  48. Expected<std::unique_ptr<LinkGraph>>
  49. createLinkGraphFromMachOObject_arm64(MemoryBufferRef ObjectBuffer);
  50. /// jit-link the given object buffer, which must be a MachO arm64 object file.
  51. ///
  52. /// If PrePrunePasses is empty then a default mark-live pass will be inserted
  53. /// that will mark all exported atoms live. If PrePrunePasses is not empty, the
  54. /// caller is responsible for including a pass to mark atoms as live.
  55. ///
  56. /// If PostPrunePasses is empty then a default GOT-and-stubs insertion pass will
  57. /// be inserted. If PostPrunePasses is not empty then the caller is responsible
  58. /// for including a pass to insert GOT and stub edges.
  59. void link_MachO_arm64(std::unique_ptr<LinkGraph> G,
  60. std::unique_ptr<JITLinkContext> Ctx);
  61. /// Return the string name of the given MachO arm64 edge kind.
  62. const char *getMachOARM64RelocationKindName(Edge::Kind R);
  63. } // end namespace jitlink
  64. } // end namespace llvm
  65. #endif // LLVM_EXECUTIONENGINE_JITLINK_MACHO_ARM64_H
  66. #ifdef __GNUC__
  67. #pragma GCC diagnostic pop
  68. #endif