RelocationResolver.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- RelocVisitor.h - Visitor for object file relocations -----*- 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. // This file provides a wrapper around all the different types of relocations
  15. // in different file formats, such that a client can handle them in a unified
  16. // manner by only implementing a minimal number of functions.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_OBJECT_RELOCATIONRESOLVER_H
  20. #define LLVM_OBJECT_RELOCATIONRESOLVER_H
  21. #include <cstdint>
  22. #include <utility>
  23. namespace llvm {
  24. namespace object {
  25. class ObjectFile;
  26. class RelocationRef;
  27. using SupportsRelocation = bool (*)(uint64_t);
  28. using RelocationResolver = uint64_t (*)(uint64_t Type, uint64_t Offset,
  29. uint64_t S, uint64_t LocData,
  30. int64_t Addend);
  31. std::pair<SupportsRelocation, RelocationResolver>
  32. getRelocationResolver(const ObjectFile &Obj);
  33. uint64_t resolveRelocation(RelocationResolver Resolver, const RelocationRef &R,
  34. uint64_t S, uint64_t LocData);
  35. } // end namespace object
  36. } // end namespace llvm
  37. #endif // LLVM_OBJECT_RELOCATIONRESOLVER_H
  38. #ifdef __GNUC__
  39. #pragma GCC diagnostic pop
  40. #endif