Skip to content

Commit 57486c4

Browse files
author
Solid Snake
committed
Correct sbss/bss symbol alignment to use the type size rather than section size or hard coded value of 4.
1 parent a770cb7 commit 57486c4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tools/psyq-obj-parser/psyq-obj-parser.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,13 @@ std::unique_ptr<PsyqLnkFile> PsyqLnkFile::parse(PCSX::File* file, bool verbose)
410410
symbol->name = name;
411411
auto section = ret->sections.find(sectionIndex);
412412
if (section == ret->sections.end()) {
413-
fmt::print("Section {} not found for.\n", sectionIndex);
413+
fmt::print("Section {} not found for {}.\n", sectionIndex, name);
414414
return nullptr;
415415
}
416416

417-
// A PSYQ section may have an alignment of 8, but each var within the section seems to always be aligned to 4.
418-
// So the section alignment appears to apply to the section as a whole rather than the invidual entries within it.
419-
const auto bssAlignment = 4;
420-
auto align = bssAlignment - 1;
417+
// Each entry is aligned to the size of the type after testing the output of mixed .bss and sbss with psyq GCC 2.7.2
418+
// this works the same way as modern GCC.
419+
auto align = symbol->size - 1;
421420
section->uninitializedOffset += align;
422421
section->uninitializedOffset &= ~align;
423422
symbol->offset = section->uninitializedOffset;

0 commit comments

Comments
 (0)