Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -247,6 +247,26 @@ void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; bool usesOnlyLowPageBits(uint32_t Type) const override; }; + +class AVRTargetInfo final : public TargetInfo { +public: + AVRTargetInfo(); + RelExpr getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const override; + bool isPicRel(uint32_t Type) const override; + uint32_t getDynRel(uint32_t Type) const override; + int64_t getImplicitAddend(const uint8_t *Buf, uint32_t Type) const override; + void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; + void writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const override; + void writePltHeader(uint8_t *Buf) const override; + void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, + int32_t Index, unsigned RelOff) const override; + void addPltSymbols(InputSectionBase *IS, uint64_t Off) const override; + void addPltHeaderSymbols(InputSectionBase *ISD) const override; + bool needsThunk(RelExpr Expr, uint32_t RelocType, const InputFile *File, + const SymbolBody &S) const override; + void relocateOne(uint8_t *Loc, uint32_t Type, uint64_t Val) const override; +}; } // anonymous namespace TargetInfo *createTarget() { @@ -281,6 +301,8 @@ if (Config->EKind == ELF32LEKind) return make>(); return make>(); + case EM_AVR: + return make(); } fatal("unknown target machine"); } @@ -2400,5 +2422,56 @@ bool MipsTargetInfo::usesOnlyLowPageBits(uint32_t Type) const { return Type == R_MIPS_LO16 || Type == R_MIPS_GOT_OFST; } + +AVRTargetInfo::AVRTargetInfo() { +} + +RelExpr AVRTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S, + const uint8_t *Loc) const { + return R_NONE; +} + +bool AVRTargetInfo::isPicRel(uint32_t Type) const { + return true; +} + +uint32_t AVRTargetInfo::getDynRel(uint32_t Type) const { + return Type; +} + +int64_t AVRTargetInfo::getImplicitAddend(const uint8_t *Buf, + uint32_t Type) const { + return 0; +} + +void AVRTargetInfo::writeGotPlt(uint8_t *Buf, const SymbolBody &S) const { +} + +void AVRTargetInfo::writeIgotPlt(uint8_t *Buf, const SymbolBody &S) const { +} + +void AVRTargetInfo::writePltHeader(uint8_t *Buf) const { +} + +void AVRTargetInfo::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, + uint64_t PltEntryAddr, int32_t Index, + unsigned RelOff) const { +} + +void AVRTargetInfo::addPltSymbols(InputSectionBase *IS, uint64_t Off) const { +} + +void AVRTargetInfo::addPltHeaderSymbols(InputSectionBase *ISD) const { +} + +bool AVRTargetInfo::needsThunk(RelExpr Expr, uint32_t RelocType, + const InputFile *File, + const SymbolBody &S) const { + return true; +} + +void AVRTargetInfo::relocateOne(uint8_t *Loc, uint32_t Type, + uint64_t Val) const { +} } }