[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
================
@@ -98,11 +98,26 @@ bool XCOFFWriter::nameShouldBeInStringTable(StringRef SymbolName) {
bool XCOFFWriter::initRelocations(uint64_t &CurrentOffset) {
for (XCOFFYAML::Section &InitSection : InitSections) {
if (!InitSection.Relocations.empty()) {
- InitSection.NumberOfRelocations = InitSection.Relocations.size();
- InitSection.FileOffsetToRelocations = CurrentOffset;
uint64_t RelSize = Is64Bit ? XCOFF::RelocationSerializationSize64
: XCOFF::RelocationSerializationSize32;
- CurrentOffset += InitSection.NumberOfRelocations * RelSize;
+ const uint64_t UsedSize = RelSize * InitSection.Relocations.size();
----------------
jh7370 wrote:
Nit: the use of `const` here is a bit offputting, given it's not used for other local variables that don't change in the area. I'd probably not bother with it.
https://github.com/llvm/llvm-project/pull/77620
More information about the llvm-commits
mailing list