shithub: rgbds

Download patch

ref: 46d6652df110b62ea1fcbc21400bb50937457e76
parent: 5406674cdd3f4be6d4abf9ef523fa116b08f54e7
author: ISSOtm <[email protected]>
date: Mon Mar 22 19:22:53 EDT 2021

Fix missing .sym/.map symbols in SECTION UNION/FRAGMENTs

Only the first "slice"'s symbols were considered, forgetting some symbols

--- a/src/link/output.c
+++ b/src/link/output.c
@@ -368,10 +368,16 @@
 			fprintf(mapFile, "  SECTION: $%04" PRIx16 " (0 bytes) [\"%s\"]\n",
 				sect->org, sect->name);
 
-		for (size_t i = 0; i < sect->nbSymbols; i++)
-			fprintf(mapFile, "           $%04" PRIx32 " = %s\n",
-				sect->symbols[i]->offset + sect->org,
-				sect->symbols[i]->name);
+		uint16_t org = sect->org;
+
+		while (sect) {
+			for (size_t i = 0; i < sect->nbSymbols; i++)
+				fprintf(mapFile, "           $%04" PRIx32 " = %s\n",
+					sect->symbols[i]->offset + org,
+					sect->symbols[i]->name);
+
+			sect = sect->nextu; // Also print symbols in the following "pieces"
+		}
 
 		*pickedSection = (*pickedSection)->next;
 	}