diff --git a/src/asm/output.c b/src/asm/output.c index ed643df7..b28b6de6 100644 --- a/src/asm/output.c +++ b/src/asm/output.c @@ -521,8 +521,9 @@ static void checksectionoverflow(uint32_t delta_size) { uint32_t maxsize = getmaxsectionsize(pCurrentSection->nType, 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 * sections that are too big and to prevent the assembler from @@ -530,8 +531,8 @@ static void checksectionoverflow(uint32_t delta_size) * memory. * The real check must be done at the linking stage. */ - fatalerror("Section '%s' is too big (max size = 0x%X bytes).", - pCurrentSection->pzName, maxsize); + fatalerror("Section '%s' is too big (max size = 0x%X bytes, reached 0x%X).", + pCurrentSection->pzName, maxsize, new_size); } }