[llvm] [yaml2obj][XOFF] Update yaml2obj for XCOFF to create valid XCOFF files in more cases. (PR #77620)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 01:04:02 PST 2024
================
@@ -320,30 +361,32 @@ void XCOFFWriter::initAuxFileHeader() {
}
bool XCOFFWriter::assignAddressesAndIndices() {
- uint64_t FileHdrSize =
+ const uint64_t FileHdrSize =
Is64Bit ? XCOFF::FileHeaderSize64 : XCOFF::FileHeaderSize32;
- uint64_t AuxFileHdrSize = 0;
- if (Obj.AuxHeader)
- AuxFileHdrSize = Obj.Header.AuxHeaderSize
- ? Obj.Header.AuxHeaderSize
- : (Is64Bit ? XCOFF::AuxFileHeaderSize64
- : XCOFF::AuxFileHeaderSize32);
- uint64_t SecHdrSize =
+
+ // If AuxHeaderSize is specified in the YAML file, we construct
+ // an auxiliary header.
+ const uint64_t AuxFileHdrSize =
+ Obj.Header.AuxHeaderSize ? *Obj.Header.AuxHeaderSize
+ : !Obj.AuxHeader
+ ? 0
+ : (Is64Bit ? XCOFF::AuxFileHeaderSize64 : XCOFF::AuxFileHeaderSize32);
----------------
jh7370 wrote:
This code is now less readable than before. It's not necessary to use `const` everywhere, so go back to the old style, please.
https://github.com/llvm/llvm-project/pull/77620
More information about the llvm-commits
mailing list