llvm/llvm/lib/Object/RelocationResolver.cpp

//===- RelocationResolver.cpp ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines utilities to resolve relocations in object files.
//
//===----------------------------------------------------------------------===//

#include "llvm/Object/RelocationResolver.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/ELFTypes.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/SymbolicFile.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/TargetParser/Triple.h"
#include <cassert>

namespace llvm {
namespace object {

static int64_t getELFAddend(RelocationRef R) {}

static bool supportsX86_64(uint64_t Type) {}

static uint64_t resolveX86_64(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t LocData, int64_t Addend) {}

static bool supportsAArch64(uint64_t Type) {}

static uint64_t resolveAArch64(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsBPF(uint64_t Type) {}

static uint64_t resolveBPF(uint64_t Type, uint64_t Offset, uint64_t S,
                           uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsMips64(uint64_t Type) {}

static uint64_t resolveMips64(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsMSP430(uint64_t Type) {}

static uint64_t resolveMSP430(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsPPC64(uint64_t Type) {}

static uint64_t resolvePPC64(uint64_t Type, uint64_t Offset, uint64_t S,
                             uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsSystemZ(uint64_t Type) {}

static uint64_t resolveSystemZ(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsSparc64(uint64_t Type) {}

static uint64_t resolveSparc64(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t /*LocData*/, int64_t Addend) {}

/// Returns true if \c Obj is an AMDGPU code object based solely on the value
/// of e_machine.
///
/// AMDGPU code objects with an e_machine of EF_AMDGPU_MACH_NONE do not
/// identify their arch as either r600 or amdgcn, but we can still handle
/// their relocations. When we identify an ELF object with an UnknownArch,
/// we use isAMDGPU to check for this case.
static bool isAMDGPU(const ObjectFile &Obj) {}

static bool supportsAmdgpu(uint64_t Type) {}

static uint64_t resolveAmdgpu(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsX86(uint64_t Type) {}

static uint64_t resolveX86(uint64_t Type, uint64_t Offset, uint64_t S,
                           uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsPPC32(uint64_t Type) {}

static uint64_t resolvePPC32(uint64_t Type, uint64_t Offset, uint64_t S,
                             uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsARM(uint64_t Type) {}

static uint64_t resolveARM(uint64_t Type, uint64_t Offset, uint64_t S,
                           uint64_t LocData, int64_t Addend) {}

static bool supportsAVR(uint64_t Type) {}

static uint64_t resolveAVR(uint64_t Type, uint64_t Offset, uint64_t S,
                           uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsLanai(uint64_t Type) {}

static uint64_t resolveLanai(uint64_t Type, uint64_t Offset, uint64_t S,
                             uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsMips32(uint64_t Type) {}

static uint64_t resolveMips32(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsSparc32(uint64_t Type) {}

static uint64_t resolveSparc32(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t LocData, int64_t Addend) {}

static bool supportsHexagon(uint64_t Type) {}

static uint64_t resolveHexagon(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t /*LocData*/, int64_t Addend) {}

static bool supportsRISCV(uint64_t Type) {}

static uint64_t resolveRISCV(uint64_t Type, uint64_t Offset, uint64_t S,
                             uint64_t LocData, int64_t Addend) {}

static bool supportsCSKY(uint64_t Type) {}

static uint64_t resolveCSKY(uint64_t Type, uint64_t Offset, uint64_t S,
                            uint64_t LocData, int64_t Addend) {}

static bool supportsLoongArch(uint64_t Type) {}

static uint64_t resolveLoongArch(uint64_t Type, uint64_t Offset, uint64_t S,
                                 uint64_t LocData, int64_t Addend) {}

static bool supportsCOFFX86(uint64_t Type) {}

static uint64_t resolveCOFFX86(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsCOFFX86_64(uint64_t Type) {}

static uint64_t resolveCOFFX86_64(uint64_t Type, uint64_t Offset, uint64_t S,
                                  uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsCOFFARM(uint64_t Type) {}

static uint64_t resolveCOFFARM(uint64_t Type, uint64_t Offset, uint64_t S,
                               uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsCOFFARM64(uint64_t Type) {}

static uint64_t resolveCOFFARM64(uint64_t Type, uint64_t Offset, uint64_t S,
                                 uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsMachOX86_64(uint64_t Type) {}

static uint64_t resolveMachOX86_64(uint64_t Type, uint64_t Offset, uint64_t S,
                                   uint64_t LocData, int64_t /*Addend*/) {}

static bool supportsWasm32(uint64_t Type) {}

static bool supportsWasm64(uint64_t Type) {}

static uint64_t resolveWasm32(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t LocData, int64_t /*Addend*/) {}

static uint64_t resolveWasm64(uint64_t Type, uint64_t Offset, uint64_t S,
                              uint64_t LocData, int64_t Addend) {}

std::pair<SupportsRelocation, RelocationResolver>
getRelocationResolver(const ObjectFile &Obj) {}

uint64_t resolveRelocation(RelocationResolver Resolver, const RelocationRef &R,
                           uint64_t S, uint64_t LocData) {}

} // namespace object
} // namespace llvm