[PATCH] D21024: [llvm-readobj] - Teach llvm-readobj to dump .gnu.version_r sections

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 04:20:07 PDT 2016


grimar added a comment.

Rafael, Davide, thanks for review !


================
Comment at: tools/llvm-readobj/ELFDumper.cpp:583
@@ +582,3 @@
+  StringRef Name = unwrapOrError(Obj->getSectionName(Sec));
+  W.printNumber("Section Name", Name, Sec->sh_name);
+  W.printHex("Address", Sec->sh_addr);
----------------
rafael wrote:
> I don't think this should print Name/Address/Offset/Link. They are available from -s.
> 
Removed.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:603
@@ +602,3 @@
+    W.printNumber("Version", Need->vn_version);
+    W.printNumber("Count", Need->vn_cnt);
+    W.printString("Name",
----------------
rafael wrote:
> Not sure we need to print vn_cnt, since we print vn_cnt entries.
I would leave it. There can be lots of vn_aux and it can be reasonable to print the amount to know that value for possible testcases. Counting them all manually can be a problem.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:604
@@ +603,3 @@
+    W.printNumber("Count", Need->vn_cnt);
+    W.printString("Name",
+                  StringRef((const char *)(Obj->base() + StrTab->sh_offset +
----------------
rafael wrote:
> FileName maybe?
Done.

================
Comment at: tools/llvm-readobj/ELFDumper.cpp:613
@@ +612,3 @@
+      W.printNumber("Hash", Aux->vna_hash);
+      W.printNumber("Flags", Aux->vna_flags);
+      W.printNumber("Index", Aux->vna_other);
----------------
rafael wrote:
> Don't we want to expand this into an enum?
Done. Btw according to gold sources I have, it is always 0 currently:

  for (p = this->need_versions_.begin(), i = 0;
       p != this->need_versions_.end();
       ++p, ++i)
    {
      elfcpp::Vernaux_write<size, big_endian> vna(pb);
      vna.set_vna_hash(Dynobj::elf_hash((*p)->version()));
      // FIXME: We need to sometimes set VER_FLG_WEAK here.
      vna.set_vna_flags(0);
      vna.set_vna_other((*p)->index());
      vna.set_vna_name(dynpool->get_offset((*p)->version()));
      vna.set_vna_next(i + 1 >= this->need_versions_.size()
		       ? 0
		       : vernaux_size);
      pb += vernaux_size;
    }


Repository:
  rL LLVM

http://reviews.llvm.org/D21024





More information about the llvm-commits mailing list