[PATCH] Make it easier to use DwarfContext with MCJIT and add RelocVisitor support for Darwin
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Thu Jan 15 07:47:09 PST 2015
REPOSITORY
rL LLVM
================
Comment at: include/llvm/Object/ELFObjectFile.h:569
@@ -567,1 +568,3 @@
+// ELF relocations can not target sections
+template <class ELFT>
----------------
Not directly, but It is valid to write
.long .text
and it is represented as a relocation to a symbol, and the symbol has type STT_SECTION.
Would it be desirable to check for that here? If not, please expand the comment a bit.
================
Comment at: include/llvm/Object/MachO.h:249
@@ -247,2 +248,3 @@
bool &Result) const override;
+ std::error_code getRelocationLength(DataRefImpl Rel, uint8_t &Res) const;
----------------
Please return an ErrorOr<uint8_t>.
================
Comment at: include/llvm/Object/RelocVisitor.h:278
@@ +277,3 @@
+ uint8_t Length;
+ Obj->getRelocationLength(DRI, Length);
+ return Length;
----------------
As you can see it is way too easy to ignore a std::error_code return :-)
================
Comment at: lib/Object/COFFObjectFile.cpp:1040
@@ -1039,1 +1039,3 @@
+section_iterator COFFObjectFile::getRelocationSection(DataRefImpl Rel) const {
+ return section_end();
----------------
Someone familiar with COFF should check this.
================
Comment at: lib/Object/MachOObjectFile.cpp:1010
@@ +1009,3 @@
+ Res = getAnyRelocationLength(RE);
+ return object_error::success;
+}
----------------
Actually, if this is never going to fail, just return a uint8_t.
http://reviews.llvm.org/D6961
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list