[PATCH] Fix "llvm-objdump -d -r" to show relocations inline for ELF files

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Wed Jan 15 17:58:49 PST 2014



================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:392
@@ +391,3 @@
+                        i != e; i.increment(ec)) {
+    if (error(ec)) break;
+    section_iterator Sec2 = i->getRelocatedSection();
----------------
please use llvm naming style, so EC.
clang-format. In particular, break in another line.


================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:395
@@ +394,3 @@
+    if (Sec2 != Obj->end_sections())
+      SectionRelocMap.insert(std::pair<SectionRef, SectionRef>(*Sec2, *i));
+  }
----------------
This assumes that only one section has relocations for another section. That is probably an OK assumption to start with, but please assert it.

If you are interested you might also want to add a test with a .so in the future. The relocations on shared objects have a slightly different representation from the ones in relocatable objects.



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



More information about the llvm-commits mailing list