RuntimeDyldELFMips.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //===-- RuntimeDyldELFMips.h ---- ELF/Mips specific code. -------*- 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_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDELFMIPS_H
  9. #define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDELFMIPS_H
  10. #include "../RuntimeDyldELF.h"
  11. #define DEBUG_TYPE "dyld"
  12. namespace llvm {
  13. class RuntimeDyldELFMips : public RuntimeDyldELF {
  14. public:
  15. typedef uint64_t TargetPtrT;
  16. RuntimeDyldELFMips(RuntimeDyld::MemoryManager &MM,
  17. JITSymbolResolver &Resolver)
  18. : RuntimeDyldELF(MM, Resolver) {}
  19. void resolveRelocation(const RelocationEntry &RE, uint64_t Value) override;
  20. protected:
  21. void resolveMIPSO32Relocation(const SectionEntry &Section, uint64_t Offset,
  22. uint32_t Value, uint32_t Type, int32_t Addend);
  23. void resolveMIPSN32Relocation(const SectionEntry &Section, uint64_t Offset,
  24. uint64_t Value, uint32_t Type, int64_t Addend,
  25. uint64_t SymOffset, SID SectionID);
  26. void resolveMIPSN64Relocation(const SectionEntry &Section, uint64_t Offset,
  27. uint64_t Value, uint32_t Type, int64_t Addend,
  28. uint64_t SymOffset, SID SectionID);
  29. private:
  30. /// A object file specific relocation resolver
  31. /// \param RE The relocation to be resolved
  32. /// \param Value Target symbol address to apply the relocation action
  33. uint64_t evaluateRelocation(const RelocationEntry &RE, uint64_t Value,
  34. uint64_t Addend);
  35. /// A object file specific relocation resolver
  36. /// \param RE The relocation to be resolved
  37. /// \param Value Target symbol address to apply the relocation action
  38. void applyRelocation(const RelocationEntry &RE, uint64_t Value);
  39. int64_t evaluateMIPS32Relocation(const SectionEntry &Section, uint64_t Offset,
  40. uint64_t Value, uint32_t Type);
  41. int64_t evaluateMIPS64Relocation(const SectionEntry &Section,
  42. uint64_t Offset, uint64_t Value,
  43. uint32_t Type, int64_t Addend,
  44. uint64_t SymOffset, SID SectionID);
  45. void applyMIPSRelocation(uint8_t *TargetPtr, int64_t CalculatedValue,
  46. uint32_t Type);
  47. };
  48. }
  49. #undef DEBUG_TYPE
  50. #endif