[PATCH] D82549: [AIX][XCOFF] parsing xcoff object file auxiliary header

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 06:26:39 PDT 2021


DiggerLin added inline comments.


================
Comment at: llvm/tools/llvm-readobj/Opts.td:87
+// XCOFF specific options.
+def auxiliary_header : FF<"auxiliary-header" , "display the auxiliary header">;
+
----------------
Esme wrote:
> 
thanks



================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:54
+  void printAuxiliaryHeader(const XCOFFAuxiliaryHeader32 *AuxHeader);
+  void printAuxiliaryHeader(const XCOFFAuxiliaryHeader64 *AuxHeader);
   const XCOFFObjectFile &Obj;
----------------
Esme wrote:
> I noticed that the the two functions are very similar, can we make these common to avoid code duplication? As far as I know, almost all members are the same for 32-bit and 64-bit except for `"Additional flags 64-bit XCOFF", XCOFF64Flag`.
> I.e. use `template <typename AuxT> void printAuxiliaryHeader(AuxT *AuxHeader);` to replace them.
I have think it over before, But I do not think it is possible to use a template to do it. because the member (and the order of the members) of XCOFFAuxiliaryHeader64 and XCOFFAuxiliaryHeader32 are different. and we need to print out the info based on the order which defined in the https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__fyovh386shar


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82549



More information about the llvm-commits mailing list