[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
================
@@ -134,23 +144,46 @@ bool XCOFFWriter::initSectionHeader(uint64_t &CurrentOffset) {
}
}
- // Calculate the physical/virtual address. This field should contain 0 for
- // all sections except the text, data and bss sections.
- if (InitSections[I].Flags != XCOFF::STYP_TEXT &&
- InitSections[I].Flags != XCOFF::STYP_DATA &&
- InitSections[I].Flags != XCOFF::STYP_BSS)
- InitSections[I].Address = 0;
- else
- InitSections[I].Address = CurrentSecAddr;
+ if (!InitSections[I].Size)
+ InitSections[I].Size = InitSections[I].SectionData.binary_size();
+
+ // We cannot compute section addresses in general. We only enforce
+ // the rule .data and .bss are consecutive, as are .tdata and .tbss.
----------------
jh7370 wrote:
Is "enforce" the right term? It seems like you should be able to use yaml2obj to specify any old address (though I agree that a sensible default makes sense).
More generally, I'd like to understand why text addresses are no longer set here?
https://github.com/llvm/llvm-project/pull/77620
More information about the llvm-commits
mailing list