Skip to content

Commit

Permalink
[makerom] Change elf processing to no longer strictly require data se…
Browse files Browse the repository at this point in the history
…ction. (#143)
  • Loading branch information
jakcron authored Sep 30, 2023
1 parent 7e645b2 commit ea2390d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions makerom/src/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ int CreateExeFsCode(elf_context *elf, ncch_settings *set)

/* Checking the existence of essential ELF Segments */
if (!text.fileSize) return NOT_FIND_TEXT_SEGMENT;
if (!rwdata.fileSize) return NOT_FIND_DATA_SEGMENT;

/* Calculating BSS size */
set->codeDetails.bssSize = rwdata.memSize - rwdata.fileSize;

/* Allocating Buffer for ExeFs Code */
bool noCodePadding = set->options.noCodePadding;
Expand Down Expand Up @@ -209,7 +205,7 @@ int CreateExeFsCode(elf_context *elf, ncch_settings *set)
set->exefsSections.code.buffer = code;
}

/* Setting code_segment data and freeing original buffers */
/* Setting code_segment data */
set->codeDetails.textAddress = text.address;
set->codeDetails.textMaxPages = text.pageNum;
set->codeDetails.textSize = text.fileSize;
Expand All @@ -222,6 +218,14 @@ int CreateExeFsCode(elf_context *elf, ncch_settings *set)
set->codeDetails.rwMaxPages = rwdata.pageNum;
set->codeDetails.rwSize = rwdata.fileSize;

/* Calculating BSS size */
if (rwdata.fileSize) {
set->codeDetails.bssSize = rwdata.memSize - rwdata.fileSize;
}
else {
set->codeDetails.bssSize = 0;
}

if (set->rsfSet->SystemControlInfo.StackSize)
set->codeDetails.stackSize = strtoul(set->rsfSet->SystemControlInfo.StackSize, NULL, 0);
else {
Expand Down

0 comments on commit ea2390d

Please sign in to comment.