Merge pull request #361 from ISSOtm/better_section_overflow

Improve section overflow error message
This commit is contained in:
Eldred Habert
2019-08-29 20:04:48 +02:00
committed by GitHub

View File

@@ -521,8 +521,9 @@ static void checksectionoverflow(uint32_t delta_size)
{ {
uint32_t maxsize = getmaxsectionsize(pCurrentSection->nType, uint32_t maxsize = getmaxsectionsize(pCurrentSection->nType,
pCurrentSection->pzName); pCurrentSection->pzName);
uint32_t new_size = pCurrentSection->nPC + delta_size;
if (pCurrentSection->nPC + delta_size > maxsize) { if (new_size > maxsize) {
/* /*
* This check is here to trap broken code that generates * This check is here to trap broken code that generates
* sections that are too big and to prevent the assembler from * sections that are too big and to prevent the assembler from
@@ -530,8 +531,8 @@ static void checksectionoverflow(uint32_t delta_size)
* memory. * memory.
* The real check must be done at the linking stage. * The real check must be done at the linking stage.
*/ */
fatalerror("Section '%s' is too big (max size = 0x%X bytes).", fatalerror("Section '%s' is too big (max size = 0x%X bytes, reached 0x%X).",
pCurrentSection->pzName, maxsize); pCurrentSection->pzName, maxsize, new_size);
} }
} }