Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -247,6 +247,19 @@ 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; + 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 +294,8 @@ if (Config->EKind == ELF32LEKind) return make>(); return make>(); + case EM_AVR: + return make(); } fatal("unknown target machine"); } @@ -2400,5 +2415,36 @@ 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; +} + +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 { +} } }