llvm/lld/MachO/Arch/ARM64Common.h

//===- ARM64Common.h --------------------------------------------*- 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
//
//===----------------------------------------------------------------------===//

#ifndef LLD_MACHO_ARCH_ARM64COMMON_H
#define LLD_MACHO_ARCH_ARM64COMMON_H

#include "InputFiles.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"

#include "llvm/BinaryFormat/MachO.h"

namespace lld::macho {

struct ARM64Common : TargetInfo {};

inline uint64_t bitField(uint64_t value, int right, int width, int left) {}

//              25                                                0
// +-----------+---------------------------------------------------+
// |           |                       imm26                       |
// +-----------+---------------------------------------------------+

inline void encodeBranch26(uint32_t *loc, const Reloc &r, uint32_t base,
                           uint64_t va) {}

inline void encodeBranch26(uint32_t *loc, SymbolDiagnostic d, uint32_t base,
                           uint64_t va) {}

//   30 29          23                                  5
// +-+---+---------+-------------------------------------+---------+
// | |ilo|         |                immhi                |         |
// +-+---+---------+-------------------------------------+---------+

inline void encodePage21(uint32_t *loc, const Reloc &r, uint32_t base,
                         uint64_t va) {}

inline void encodePage21(uint32_t *loc, SymbolDiagnostic d, uint32_t base,
                         uint64_t va) {}

void reportUnalignedLdrStr(void *loc, const Reloc &, uint64_t va, int align);
void reportUnalignedLdrStr(void *loc, SymbolDiagnostic, uint64_t va, int align);

//                      21                   10
// +-------------------+-----------------------+-------------------+
// |                   |         imm12         |                   |
// +-------------------+-----------------------+-------------------+

template <typename Target>
inline void encodePageOff12(uint32_t *loc, Target t, uint32_t base,
                            uint64_t va) {}

inline uint64_t pageBits(uint64_t address) {}

inline void writeStub(uint8_t *buf8, const uint32_t stubCode[3],
                      const macho::Symbol &sym, uint64_t pointerVA) {}

template <class LP>
inline void writeStubHelperHeader(uint8_t *buf8,
                                  const uint32_t stubHelperHeaderCode[6]) {}

inline void writeStubHelperEntry(uint8_t *buf8,
                                 const uint32_t stubHelperEntryCode[3],
                                 const Symbol &sym, uint64_t entryVA) {}

template <class LP>
inline void writeObjCMsgSendFastStub(uint8_t *buf,
                                     const uint32_t objcStubsFastCode[8],
                                     Symbol *sym, uint64_t stubsAddr,
                                     uint64_t stubOffset, uint64_t selrefVA,
                                     uint64_t gotAddr, uint64_t msgSendIndex) {}

template <class LP>
inline void
writeObjCMsgSendSmallStub(uint8_t *buf, const uint32_t objcStubsSmallCode[3],
                          Symbol *sym, uint64_t stubsAddr, uint64_t stubOffset,
                          uint64_t selrefVA, uint64_t msgSendAddr,
                          uint64_t msgSendIndex) {}

} // namespace lld::macho

#endif