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

Esme Yi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 23:50:22 PDT 2021


Esme added a comment.

I have no more comments. But please wait and see if James @jhenderson has other comments.



================
Comment at: llvm/tools/llvm-readobj/XCOFFDumper.cpp:54
+  void printAuxiliaryHeader(const XCOFFAuxiliaryHeader32 *AuxHeader);
+  void printAuxiliaryHeader(const XCOFFAuxiliaryHeader64 *AuxHeader);
   const XCOFFObjectFile &Obj;
----------------
DiggerLin wrote:
> 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
Thanks. 
In fact, I wouldn't require members to be printed strictly in the order of their offsets. But, of course, printing in order also makes sense to me.


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