[PATCH] D57365: [llvm-readobj] Add a flag to dump just the section-to-segment mapping.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 29 02:29:01 PST 2019


jhenderson added reviewers: jhenderson, grimar, rupprecht.
jhenderson added a comment.

FYI, I've added a couple more reviewers who have reviewed some of my recent changes in this area too.

How about a test case for the new switch?



================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:341
                            bool IsDynamic) = 0;
+  virtual void printSectionMapping(const ELFFile<ELFT> *Obj) = 0;
   virtual void printProgramHeaders(const ELFFile<ELFT> *Obj) = 0;
----------------
Could this have a default definition, like `printHashSymbols` above?


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:467
   void printDynamicRelocations(const ELFO *Obj) override;
+  void printSectionMapping(const ELFO *Obj) override {}
   void printProgramHeaders(const ELFO *Obj) override;
----------------
Not that it needs to be part of this change, but it might be nice if this were to be implemented for LLVM output style at some point.


================
Comment at: llvm/tools/llvm-readobj/llvm-readobj.cpp:466-467
     Dumper->printFileHeaders();
+  if (opts::SectionMapping)
+    Dumper->printSectionMapping();
   if (opts::SectionHeaders)
----------------
One thing I think we want to avoid is printing this mapping separately if `--section-mapping` and `--program-headers` are both specified.

Also, my gut feeling is that the output would be easier to read for `--section-headers --section-mapping`, if the section mapping appears after the section headers, but I don't feel strongly about it.

Perhaps any ordering inconsistency could be solved by moving this to immediately after `printProgramHeaders`?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57365/new/

https://reviews.llvm.org/D57365





More information about the llvm-commits mailing list