[PATCH] [Object] Split the ELF interface into 3 parts.

Michael Spencer bigcheesegs at gmail.com
Tue Jun 25 12:30:41 PDT 2013


  I fixed quite a few of the style issues. Most of what's left is just what was there before.

  As for the Elf_* stuff, those are named as such because it's what the spec calls them. Although I suppose the iterators can have LLVM names.


================
Comment at: include/llvm/Object/ELF.h:1235
@@ +1234,3 @@
+template <class ELFT>
+uint64_t ELFFile<ELFT>::getStringTableIndex() const {
+  if (Header->e_shnum == ELF::SHN_UNDEF) {
----------------
Sean Silva wrote:
> Should this be `uintX_t`?
Fixed.

================
Comment at: include/llvm/Object/ELFObjectFile.h:747-751
@@ +746,7 @@
+
+template <class ELFT>
+StringRef ELFObjectFile<ELFT>::getRelocationTypeName(uint32_t Type) const {
+  StringRef Res = "Unknown";
+  switch (EF.getHeader()->e_machine) {
+  case ELF::EM_X86_64:
+    switch (Type) {
----------------
Sean Silva wrote:
> This huge switch probably should be in a static (non-templated) helper function to avoid duplicating this lookup table.
Done.

================
Comment at: include/llvm/Object/ELFObjectFile.h:742-745
@@ +741,6 @@
+
+#define LLVM_ELF_SWITCH_RELOC_TYPE_NAME(enum)                                  \
+  case ELF::enum:                                                              \
+  Res = #enum;                                                                 \
+  break;
+
----------------
Sean Silva wrote:
> Can you just directly `return #enum`?
Done.


http://llvm-reviews.chandlerc.com/D1033



More information about the llvm-commits mailing list