[PATCH] D17523: llvm-readobj: enable GNU output style sections and relocations printing for ELF files

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 12:49:13 PST 2016


Bigcheese requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:271
@@ +270,3 @@
+    Field(unsigned Col) : Str(""), Column(Col) {}
+    Field &operator=(StringRef S) {
+      Str = S;
----------------
The usage of this looks pretty weird in code. I'd prefer we not use operator overloads that don't "do what the ints do".

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:2231
@@ +2230,3 @@
+                                     const Elf_Rela &R, bool IsRela) {
+  std::string r_offset, r_info, r_addend = "", s_value;
+  SmallString<32> RelocName;
----------------
We only use the ELF spec names for types and variables that _directly_ map to the ELF file. Please use the llvm naming convention for these.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:2236
@@ +2235,3 @@
+  const Elf_Sym *Sym = nullptr;
+  unsigned bias;
+  const char *FmtCharHex;
----------------
Bias

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:2262
@@ +2261,3 @@
+  }
+  r_offset = to_hexString(format(FmtCharHex, R.r_offset));
+  r_info = to_hexString(format(FmtCharHex, R.r_info));
----------------
format cannot directly take a packed_endian_specific_integral as it is not implemented in a type safe way. It directly passes everything to snprintf, which skips the byte swapping conversion operator.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:2266
@@ +2265,3 @@
+    r_addend +=
+        R.r_addend == 0 ? std::string("0") : to_hexString(std::abs(R.r_addend), false);
+  if (Sym)
----------------
80 colums.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:2406
@@ +2405,3 @@
+  size_t sectionIndex = 0;
+  std::string number, type, size, address, offset, flags, link, info, entrysize,
+      alignment;
----------------
llvm style: Number, Type, Size, ...


Repository:
  rL LLVM

http://reviews.llvm.org/D17523





More information about the llvm-commits mailing list