[PATCH] D32991: [ELF] Initial migration of AVR target
Leslie Zhai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 00:31:48 PDT 2017
xiangzhai updated this revision to Diff 98256.
xiangzhai added a comment.
Dear Rui,
Thanks for your review!
As you suggested I have removed unnecessary functions, please review it, thanks a lot!
Regards,
Leslie Zhai
Repository:
rL LLVM
https://reviews.llvm.org/D32991
Files:
ELF/Target.cpp
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<X86_64TargetInfo<ELF32LE>>();
return make<X86_64TargetInfo<ELF64LE>>();
+ case EM_AVR:
+ return make<AVRTargetInfo>();
}
fatal("unknown target machine");
}
@@ -2400,5 +2415,36 @@
bool MipsTargetInfo<ELFT>::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 {
+}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32991.98256.patch
Type: text/x-patch
Size: 2171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170509/ca6adc05/attachment.bin>
More information about the llvm-commits
mailing list