#include "Thunks.h"
#include "Config.h"
#include "InputFiles.h"
#include "InputSection.h"
#include "OutputSections.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/CommonLinkerContext.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <cstdint>
#include <cstring>
usingnamespacellvm;
usingnamespacellvm::object;
usingnamespacellvm::ELF;
usingnamespacelld;
usingnamespacelld::elf;
namespace {
class AArch64Thunk : public Thunk { … };
class AArch64ABSLongThunk final : public AArch64Thunk { … };
class AArch64ADRPThunk final : public AArch64Thunk { … };
class AArch64BTILandingPadThunk final : public Thunk { … };
class ARMThunk : public Thunk { … };
class ThumbThunk : public Thunk { … };
class ARMV7ABSLongThunk final : public ARMThunk { … };
class ARMV7PILongThunk final : public ARMThunk { … };
class ThumbV7ABSLongThunk final : public ThumbThunk { … };
class ThumbV7PILongThunk final : public ThumbThunk { … };
class ThumbV6MABSLongThunk final : public ThumbThunk { … };
class ThumbV6MABSXOLongThunk final : public ThumbThunk { … };
class ThumbV6MPILongThunk final : public ThumbThunk { … };
class ARMV5LongLdrPcThunk final : public ARMThunk { … };
class ARMV4PILongBXThunk final : public ARMThunk { … };
class ARMV4PILongThunk final : public ARMThunk { … };
class ThumbV4PILongBXThunk final : public ThumbThunk { … };
class ThumbV4PILongThunk final : public ThumbThunk { … };
class ARMV4ABSLongBXThunk final : public ARMThunk { … };
class ThumbV4ABSLongBXThunk final : public ThumbThunk { … };
class ThumbV4ABSLongThunk final : public ThumbThunk { … };
class AVRThunk : public Thunk { … };
class MipsThunk final : public Thunk { … };
class MicroMipsThunk final : public Thunk { … };
class MicroMipsR6Thunk final : public Thunk { … };
class PPC32PltCallStub final : public Thunk { … };
class PPC32LongThunk final : public Thunk { … };
class PPC64PltCallStub final : public Thunk { … };
class PPC64R2SaveStub final : public Thunk { … };
class PPC64R12SetupStub final : public Thunk { … };
class PPC64LongBranchThunk : public Thunk { … };
class PPC64PILongBranchThunk final : public PPC64LongBranchThunk { … };
class PPC64PDLongBranchThunk final : public PPC64LongBranchThunk { … };
}
Defined *Thunk::addSymbol(StringRef name, uint8_t type, uint64_t value,
InputSectionBase §ion) { … }
void Thunk::setOffset(uint64_t newOffset) { … }
static uint64_t getAArch64ThunkDestVA(const Symbol &s, int64_t a) { … }
bool AArch64Thunk::getMayUseShortThunk() { … }
void AArch64Thunk::writeTo(uint8_t *buf) { … }
bool AArch64Thunk::needsSyntheticLandingPad() { … }
void AArch64ABSLongThunk::writeLong(uint8_t *buf) { … }
void AArch64ABSLongThunk::addSymbols(ThunkSection &isec) { … }
void AArch64ADRPThunk::writeLong(uint8_t *buf) { … }
void AArch64ADRPThunk::addSymbols(ThunkSection &isec) { … }
void AArch64BTILandingPadThunk::addSymbols(ThunkSection &isec) { … }
void AArch64BTILandingPadThunk::writeTo(uint8_t *buf) { … }
bool AArch64BTILandingPadThunk::getMayUseShortThunk() { … }
void AArch64BTILandingPadThunk::writeLong(uint8_t *buf) { … }
static uint64_t getARMThunkDestVA(const Symbol &s) { … }
bool ARMThunk::getMayUseShortThunk() { … }
void ARMThunk::writeTo(uint8_t *buf) { … }
bool ARMThunk::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
bool ThumbThunk::getMayUseShortThunk() { … }
void ThumbThunk::writeTo(uint8_t *buf) { … }
bool ThumbThunk::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
void ARMV7ABSLongThunk::writeLong(uint8_t *buf) { … }
void ARMV7ABSLongThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV7ABSLongThunk::writeLong(uint8_t *buf) { … }
void ThumbV7ABSLongThunk::addSymbols(ThunkSection &isec) { … }
void ARMV7PILongThunk::writeLong(uint8_t *buf) { … }
void ARMV7PILongThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV7PILongThunk::writeLong(uint8_t *buf) { … }
void ThumbV7PILongThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV6MABSLongThunk::writeLong(uint8_t *buf) { … }
void ThumbV6MABSLongThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV6MABSXOLongThunk::writeLong(uint8_t *buf) { … }
void ThumbV6MABSXOLongThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV6MPILongThunk::writeLong(uint8_t *buf) { … }
void ThumbV6MPILongThunk::addSymbols(ThunkSection &isec) { … }
void ARMV5LongLdrPcThunk::writeLong(uint8_t *buf) { … }
void ARMV5LongLdrPcThunk::addSymbols(ThunkSection &isec) { … }
void ARMV4ABSLongBXThunk::writeLong(uint8_t *buf) { … }
void ARMV4ABSLongBXThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV4ABSLongBXThunk::writeLong(uint8_t *buf) { … }
void ThumbV4ABSLongBXThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV4ABSLongThunk::writeLong(uint8_t *buf) { … }
void ThumbV4ABSLongThunk::addSymbols(ThunkSection &isec) { … }
void ARMV4PILongBXThunk::writeLong(uint8_t *buf) { … }
void ARMV4PILongBXThunk::addSymbols(ThunkSection &isec) { … }
void ARMV4PILongThunk::writeLong(uint8_t *buf) { … }
void ARMV4PILongThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV4PILongBXThunk::writeLong(uint8_t *buf) { … }
void ThumbV4PILongBXThunk::addSymbols(ThunkSection &isec) { … }
void ThumbV4PILongThunk::writeLong(uint8_t *buf) { … }
void ThumbV4PILongThunk::addSymbols(ThunkSection &isec) { … }
void AVRThunk::writeTo(uint8_t *buf) { … }
void AVRThunk::addSymbols(ThunkSection &isec) { … }
void MipsThunk::writeTo(uint8_t *buf) { … }
void MipsThunk::addSymbols(ThunkSection &isec) { … }
InputSection *MipsThunk::getTargetInputSection() const { … }
void MicroMipsThunk::writeTo(uint8_t *buf) { … }
void MicroMipsThunk::addSymbols(ThunkSection &isec) { … }
InputSection *MicroMipsThunk::getTargetInputSection() const { … }
void MicroMipsR6Thunk::writeTo(uint8_t *buf) { … }
void MicroMipsR6Thunk::addSymbols(ThunkSection &isec) { … }
InputSection *MicroMipsR6Thunk::getTargetInputSection() const { … }
void elf::writePPC32PltCallStub(Ctx &ctx, uint8_t *buf, uint64_t gotPltVA,
const InputFile *file, int64_t addend) { … }
void PPC32PltCallStub::writeTo(uint8_t *buf) { … }
void PPC32PltCallStub::addSymbols(ThunkSection &isec) { … }
bool PPC32PltCallStub::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
void PPC32LongThunk::addSymbols(ThunkSection &isec) { … }
void PPC32LongThunk::writeTo(uint8_t *buf) { … }
void elf::writePPC64LoadAndBranch(uint8_t *buf, int64_t offset) { … }
void PPC64PltCallStub::writeTo(uint8_t *buf) { … }
void PPC64PltCallStub::addSymbols(ThunkSection &isec) { … }
bool PPC64PltCallStub::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
void PPC64R2SaveStub::writeTo(uint8_t *buf) { … }
void PPC64R2SaveStub::addSymbols(ThunkSection &isec) { … }
bool PPC64R2SaveStub::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
void PPC64R12SetupStub::writeTo(uint8_t *buf) { … }
void PPC64R12SetupStub::addSymbols(ThunkSection &isec) { … }
bool PPC64R12SetupStub::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
void PPC64LongBranchThunk::writeTo(uint8_t *buf) { … }
void PPC64LongBranchThunk::addSymbols(ThunkSection &isec) { … }
bool PPC64LongBranchThunk::isCompatibleWith(const InputSection &isec,
const Relocation &rel) const { … }
Thunk::Thunk(Ctx &ctx, Symbol &d, int64_t a)
: … { … }
Thunk::~Thunk() = default;
static Thunk *addThunkAArch64(Ctx &ctx, RelType type, Symbol &s, int64_t a) { … }
static Thunk *addThunkArmv4(Ctx &ctx, RelType reloc, Symbol &s, int64_t a) { … }
static Thunk *addThunkArmv5v6(Ctx &ctx, RelType reloc, Symbol &s, int64_t a) { … }
static Thunk *addThunkV6M(Ctx &ctx, const InputSection &isec, RelType reloc,
Symbol &s, int64_t a) { … }
static Thunk *addThunkArm(Ctx &ctx, const InputSection &isec, RelType reloc,
Symbol &s, int64_t a) { … }
static Thunk *addThunkAVR(Ctx &ctx, RelType type, Symbol &s, int64_t a) { … }
static Thunk *addThunkMips(Ctx &ctx, RelType type, Symbol &s) { … }
static Thunk *addThunkPPC32(Ctx &ctx, const InputSection &isec,
const Relocation &rel, Symbol &s) { … }
static Thunk *addThunkPPC64(Ctx &ctx, RelType type, Symbol &s, int64_t a) { … }
Thunk *elf::addThunk(Ctx &ctx, const InputSection &isec, Relocation &rel) { … }
Thunk *elf::addLandingPadThunk(Ctx &ctx, Symbol &s, int64_t a) { … }