From 46d6652df110b62ea1fcbc21400bb50937457e76 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Mon, 22 Mar 2021 23:22:53 +0100 Subject: [PATCH] Fix missing .sym/.map symbols in SECTION UNION/FRAGMENTs Only the first "slice"'s symbols were considered, forgetting some symbols --- src/link/output.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/link/output.c b/src/link/output.c index 547caccc..8cbf6116 100644 --- a/src/link/output.c +++ b/src/link/output.c @@ -368,10 +368,16 @@ static uint16_t writeMapBank(struct SortedSections const *sectList, 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; }