From 2448dee471750d17e786b2c5e1348e7b938ac522 Mon Sep 17 00:00:00 2001 From: applestash Date: Thu, 28 Aug 2014 22:35:20 +1000 Subject: [PATCH] made bss optional --- makerom/elf.c | 10 +++++----- makerom/elf.h | 9 ++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/makerom/elf.c b/makerom/elf.c index 532d666..d30db0a 100644 --- a/makerom/elf.c +++ b/makerom/elf.c @@ -113,7 +113,6 @@ finish: if(result == NOT_ELF_FILE) fprintf(stderr,"[ELF ERROR] Not ELF File\n"); else if(result == NOT_ARM_ELF) fprintf(stderr,"[ELF ERROR] Not ARM ELF\n"); else if(result == NON_EXECUTABLE_ELF) fprintf(stderr,"[ELF ERROR] Not Executeable ELF\n"); - else if(result == NOT_FIND_BSS_SIZE) fprintf(stderr,"[ELF ERROR] BSS Size Could not be found\n"); else if(result == NOT_FIND_CODE_SECTIONS) fprintf(stderr,"[ELF ERROR] Failed to retrieve code sections from ELF\n"); else fprintf(stderr,"[ELF ERROR] Failed to process ELF file (%d)\n",result); } @@ -175,13 +174,14 @@ u32 SizeToPage(u32 memorySize, elf_context *elf) int GetBSSFromElf(elf_context *elf, u8 *elfFile, ncch_settings *set) { + set->codeDetails.bssSize = 0; + for(int i = 0; i < elf->sectionTableEntryCount; i++){ - if(IsBss(&elf->sections[i])) { + if(IsBss(&elf->sections[i])) set->codeDetails.bssSize = elf->sections[i].size; - return 0; - } } - return NOT_FIND_BSS_SIZE; + + return 0; } int ImportPlainRegionFromElf(elf_context *elf, u8 *elfFile, ncch_settings *set) // Doesn't work same as N makerom diff --git a/makerom/elf.h b/makerom/elf.h index d3a2464..4ce9121 100644 --- a/makerom/elf.h +++ b/makerom/elf.h @@ -6,11 +6,10 @@ typedef enum NOT_ARM_ELF = -11, NON_EXECUTABLE_ELF = -12, ELF_SECTION_NOT_FOUND = -13, - NOT_FIND_BSS_SIZE = -14, - NOT_FIND_CODE_SECTIONS = -15, - ELF_SEGMENT_SECTION_SIZE_MISMATCH = -16, - ELF_SEGMENTS_NOT_CONTINUOUS = -17, - ELF_SEGMENTS_NOT_FOUND = -18, + NOT_FIND_CODE_SECTIONS = -14, + ELF_SEGMENT_SECTION_SIZE_MISMATCH = -15, + ELF_SEGMENTS_NOT_CONTINUOUS = -16, + ELF_SEGMENTS_NOT_FOUND = -17, } elf_errors; typedef struct