Fixed bss handling in tools.

This commit is contained in:
yellows8 2017-12-10 23:12:15 -05:00
parent ebf81ab6ff
commit 817fec6859
2 changed files with 3 additions and 3 deletions

View File

@ -126,7 +126,7 @@ int main(int argc, char* argv[]) {
// .bss is special
if (i == 3) {
nro_hdr.bssSize = (phdr->p_memsz + 0xFFF) & ~0xFFF;
nro_hdr.bssSize = ((phdr->p_memsz - phdr->p_filesz) + 0xFFF) & ~0xFFF;
break;
}

View File

@ -127,9 +127,9 @@ int main(int argc, char* argv[]) {
nso_hdr.Segments[i].DstOff = phdr->p_vaddr;
nso_hdr.Segments[i].DecompSz = phdr->p_filesz;
// for .data segment this field contains total sz including bss
// for .data segment this field contains bss size
if (i == 2)
nso_hdr.Segments[i].AlignOrTotalSz = phdr->p_memsz;
nso_hdr.Segments[i].AlignOrTotalSz = phdr->p_memsz - phdr->p_filesz;
else
nso_hdr.Segments[i].AlignOrTotalSz = 1;