shithub: rgbds

Download patch

ref: e27f38184241c192dd1abf0747a5ca220c242d93
parent: b069278e98b19e367b78c8dc4f16ea48edfd6213
parent: e400eac42b497ca11387de0a7f3e8100d33cf6ab
author: Eldred Habert <[email protected]>
date: Thu Aug 29 16:04:48 EDT 2019

Merge pull request #361 from ISSOtm/better_section_overflow

Improve section overflow error message

--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -521,8 +521,9 @@
 {
 	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 @@
 		 * 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);
 	}
 }