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

source code of llvm/include/llvm/Object/RelocationResolver.h