[PATCH] D128148: [XCOFF] write the aux header when the visibility is specified in XCOFF32.
Esme Yi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 21 00:40:10 PDT 2022
Esme added inline comments.
================
Comment at: llvm/include/llvm/BinaryFormat/XCOFF.h:34
constexpr size_t AuxFileHeaderSize64 = 110;
+constexpr size_t AuxFileHeaderSizeObj = 28;
constexpr size_t SectionHeaderSize32 = 40;
----------------
DiggerLin wrote:
> not sure how the size 28 come from ?
> Some AIX programs generate auxiliary headers for 32-bit object files that end after the data_start field. The macro _AOUTHSZ_SHORT defines the length of such a header.
As I replied in the next comment, the value of _AOUTHSZ_SHORT here is 28.
Well, changing `AuxFileHeaderSizeObj` to `AuxFileHeaderSizeShort` might be more appropriate?
================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:309
size_t auxiliaryHeaderSize() const {
- assert(!needsAuxiliaryHeader() &&
- "Auxiliary header support not implemented.");
- return 0;
+ return HasVisibility && !is64Bit() ? XCOFF::AuxFileHeaderSizeObj : 0;
}
----------------
DiggerLin wrote:
> according to "The auxiliary header contains system-dependent and implementation-dependent information, in which is used for loading and executing a module. Information in the auxiliary header minimizes how much of the file must be processed by the system loader at execution time." in https://www.ibm.com/docs/en/aix/7.2?topic=formats-xcoff-object-file-format#XCOFF__fyovh386shar
>
> the auxiliaryHeaderSize should not depend on the HasVisibility
Thank you for your comments!
Generally, the auxiliary header should not be required by an un-executable object file. However, it may be needed in some specific cases, like the visibility case here.
Here is a related description in /usr/include/aouthdr.h of AIX.
> In general, the auxiliary header can be any size, and the length of the auxiliary in any particular object file is specified in the f_opthdr field of the XCOFF header.
> Some AIX programs generate auxiliary headers for 32-bit object files that end after the data_start field. The macro _AOUTHSZ_SHORT defines the length of such a header. No auxiliary header is required for an object file that is not an executable.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128148/new/
https://reviews.llvm.org/D128148
More information about the llvm-commits
mailing list