mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-27 15:45:30 +03:00
Avoid aligning BSS and .data individually and instead align as one
As both of these are in the same memory segment they have no individual alignment requirements, this created a bug in にゃんらぶ~私の恋の見つけ方~ where the data segment would be larger than the game expected and invalid command line arguments would be read.
This commit is contained in:
parent
e1ca24d35f
commit
d57883705d
@ -46,10 +46,10 @@ namespace skyline::loader {
|
|||||||
executable.ro.offset = header.ro.memoryOffset;
|
executable.ro.offset = header.ro.memoryOffset;
|
||||||
|
|
||||||
executable.data.contents = GetSegment(backing, header.data, header.flags.dataCompressed ? header.dataCompressedSize : 0);
|
executable.data.contents = GetSegment(backing, header.data, header.flags.dataCompressed ? header.dataCompressedSize : 0);
|
||||||
executable.data.contents.resize(util::AlignUp(executable.data.contents.size(), PAGE_SIZE));
|
|
||||||
executable.data.offset = header.data.memoryOffset;
|
executable.data.offset = header.data.memoryOffset;
|
||||||
|
|
||||||
executable.bssSize = util::AlignUp(header.bssSize, PAGE_SIZE);
|
// Data and BSS are aligned together
|
||||||
|
executable.bssSize = util::AlignUp(executable.data.contents.size() + header.bssSize, PAGE_SIZE) - executable.data.contents.size();
|
||||||
|
|
||||||
if (header.dynsym.offset + header.dynsym.size <= header.ro.decompressedSize && header.dynstr.offset + header.dynstr.size <= header.ro.decompressedSize) {
|
if (header.dynsym.offset + header.dynsym.size <= header.ro.decompressedSize && header.dynstr.offset + header.dynstr.size <= header.ro.decompressedSize) {
|
||||||
executable.dynsym = {header.dynsym.offset, header.dynsym.size};
|
executable.dynsym = {header.dynsym.offset, header.dynsym.size};
|
||||||
|
Loading…
Reference in New Issue
Block a user