ELF_x86_64.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- ELF_x86_64.h - JIT link functions for ELF/x86-64 ---*- 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 ELF/x86-64.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_JITLINK_ELF_X86_64_H
  18. #define LLVM_EXECUTIONENGINE_JITLINK_ELF_X86_64_H
  19. #include "llvm/ExecutionEngine/JITLink/JITLink.h"
  20. namespace llvm {
  21. namespace jitlink {
  22. namespace ELF_x86_64_Edges {
  23. enum ELFX86RelocationKind : Edge::Kind {
  24. Branch32 = Edge::FirstRelocation,
  25. Branch32ToStub,
  26. Pointer32,
  27. Pointer64,
  28. Pointer64Anon,
  29. PCRel32,
  30. PCRel32Minus1,
  31. PCRel32Minus2,
  32. PCRel32Minus4,
  33. PCRel32Anon,
  34. PCRel32Minus1Anon,
  35. PCRel32Minus2Anon,
  36. PCRel32Minus4Anon,
  37. PCRel32GOTLoad,
  38. PCRel32GOT,
  39. PCRel32TLV,
  40. Delta32,
  41. Delta64,
  42. NegDelta32,
  43. NegDelta64,
  44. };
  45. } // end namespace ELF_x86_64_Edges
  46. /// Create a LinkGraph from an ELF/x86-64 relocatable object.
  47. ///
  48. /// Note: The graph does not take ownership of the underlying buffer, nor copy
  49. /// its contents. The caller is responsible for ensuring that the object buffer
  50. /// outlives the graph.
  51. Expected<std::unique_ptr<LinkGraph>>
  52. createLinkGraphFromELFObject_x86_64(MemoryBufferRef ObjectBuffer);
  53. /// jit-link the given object buffer, which must be a ELF x86-64 object file.
  54. void link_ELF_x86_64(std::unique_ptr<LinkGraph> G,
  55. std::unique_ptr<JITLinkContext> Ctx);
  56. /// Return the string name of the given ELF x86-64 edge kind.
  57. StringRef getELFX86RelocationKindName(Edge::Kind R);
  58. } // end namespace jitlink
  59. } // end namespace llvm
  60. #endif // LLVM_EXECUTIONENGINE_JITLINK_ELF_X86_64_H
  61. #ifdef __GNUC__
  62. #pragma GCC diagnostic pop
  63. #endif