[PATCH] D95505: [yaml2obj] Initial support for 32-bit XCOFF in yaml2obj.

EsmeYi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 04:06:39 PST 2021


Esme added a comment.

Thank you so much for your comments! @jhenderson They are very useful.

I've updated the summary with the description of common XCOFF file format.



================
Comment at: llvm/lib/ObjectYAML/XCOFFEmitter.cpp:54
+bool XCOFFWriter::assignAddressesAndIndices() {
+  int16_t SectionIndex = 1;
+  for (auto &YamlSec : Obj.Sections) {
----------------
jhenderson wrote:
> Two questions:
> 
> 1) Why is this a signed type?
> 2) What is the maximum number of sections an XCOFF file can have? In ELF, it is effectively UINT32_MAX, for example. (In practice, it's unlikely that we'll see that many sections, but we shouldn't prevent it just due to the wrong type). This type should be big enough for whatever the max can be.
1. There are 3 reserved signed number (-2, -1, 0) for sections, and thanks for your question, which remind me to add them to IndexMap.

2. The MaxSectionIndex, jasonliu defined in XCOFFObjectWriter.cpp, is also INT16_MAX, so I stuck with the number. I am not sure whether XCOFF supports a larger number of sections. I will have a look into this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95505



More information about the llvm-commits mailing list