shithub: rgbds

Download patch

ref: 317b206fa87f0fe27884eab28e8a5bb44db6ba28
parent: 469e3e7c860ca83c85b06f46788ff6ddf72a49ac
author: AntonioND <[email protected]>
date: Wed Mar 15 19:52:05 EDT 2017

Improve map file output

Print the name of each section along with the size, base and end
addresses. If a section is empty, don't print the end address, as it
can overflow if the base address is 0.

Signed-off-by: AntonioND <[email protected]>

--- a/src/link/mapfile.c
+++ b/src/link/mapfile.c
@@ -96,9 +96,14 @@
 	SLONG i;
 
 	if (mf) {
-		fprintf(mf, "  SECTION: $%04lX-$%04lX ($%04lX bytes)\n",
-		    pSect->nOrg, pSect->nOrg + pSect->nByteSize - 1,
-		    pSect->nByteSize);
+		if (pSect->nByteSize > 0) {
+			fprintf(mf, "  SECTION: $%04lX-$%04lX ($%04lX bytes) [\"%s\"]\n",
+				pSect->nOrg, pSect->nOrg + pSect->nByteSize - 1,
+				pSect->nByteSize, pSect->pzName);
+		} else {
+			fprintf(mf, "  SECTION: $%04lX ($0 bytes) [\"%s\"]\n",
+				pSect->nOrg, pSect->pzName);
+		}
 	}
 
 	for (i = 0; i < pSect->nNumberOfSymbols; i += 1) {