[llvm] [llvm-objdump] print out xcoff file header and load section header for xcoff object file with option private-headers (PR #96350)

zhijian lin via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 06:28:43 PDT 2024


================
@@ -30,10 +32,131 @@ using namespace llvm::support;
 
 namespace {
 class XCOFFDumper : public objdump::Dumper {
+  const XCOFFObjectFile &Obj;
+  unsigned Width;
 public:
-  XCOFFDumper(const object::XCOFFObjectFile &O) : Dumper(O) {}
-  void printPrivateHeaders() override {}
+  XCOFFDumper(const object::XCOFFObjectFile &O) : Dumper(O), Obj(O) {}
+  void printPrivateHeaders() override;
+  void printFileHeader();
+  void printAuxiliaryHeader(){};
+  void printLoaderSectionHeader();
+  FormattedString formatName(StringRef Name);
+  void printHex(StringRef Name, uint64_t Value);
+  void printNumber(StringRef Name, uint64_t Value);
+  void printStrHex(StringRef Name, StringRef Str, uint64_t Value);
+  void setWidth(unsigned W) {Width =W;};
 };
+
+void XCOFFDumper::printPrivateHeaders() {
+  printFileHeader();
+  printAuxiliaryHeader();
+  printLoaderSectionHeader();
----------------
diggerlin wrote:

> Auxiliary Header(optional header?) is not part of the loader section

yes, I will have another patch to dump the `Auxiliary Header` after the patch landed.


do we have other way to dump the other info for AIX loader section?
yes, the readobj `--loader-section-symbols` ,,`--loader-section-header` and `--loader-section-relocations`, but not no option for  'Import file ID strings` , `Symbol name string table'

https://github.com/llvm/llvm-project/pull/96350


More information about the llvm-commits mailing list