shithub: rgbds

Download patch

ref: 32cb0558e45355b4b0cb2553928304ad0078afae
parent: 92b2ac3c8c47a9de73dad12bfeebf1ed25c92523
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Nov 6 12:31:49 EST 2022

Print "; Next union/fragment" between "pieces" in .map file

Resolves #1099

--- a/src/link/output.c
+++ b/src/link/output.c
@@ -460,15 +460,19 @@
 			uint16_t org = sect->org;
 
 			while (sect) {
-				if (sect->modifier == SECTION_UNION)
-					fprintf(mapFile, "\t\t; New union\n");
-				else if (sect->modifier == SECTION_FRAGMENT)
-					fprintf(mapFile, "\t\t; New fragment\n");
 				for (size_t i = 0; i < sect->nbSymbols; i++)
-					//               "\tSECTION: $xxxx ..."
+					// Space matches "\tSECTION: $xxxx ..."
 					fprintf(mapFile, "\t         $%04" PRIx32 " = %s\n",
 						sect->symbols[i]->offset + org,
 						sect->symbols[i]->name);
+
+				if (sect->nextu) {
+					// Announce the following "piece"
+					if (sect->nextu->modifier == SECTION_UNION)
+						fprintf(mapFile, "\t\t; Next union\n");
+					else if (sect->nextu->modifier == SECTION_FRAGMENT)
+						fprintf(mapFile, "\t\t; Next fragment\n");
+				}
 
 				sect = sect->nextu; // Also print symbols in the following "pieces"
 			}