From 573003113b7ddc17c42085fa059b32bf8754f48d Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Fri, 17 Apr 2020 11:34:53 +0200 Subject: [PATCH] Fix 0-byte sections incorrectly printed in map files Fixes #515 --- src/link/output.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/link/output.c b/src/link/output.c index 801bab15..6047431d 100644 --- a/src/link/output.c +++ b/src/link/output.c @@ -312,9 +312,14 @@ static void writeMapBank(struct SortedSections const *sectList, slack -= sect->size; - fprintf(mapFile, " SECTION: $%04x-$%04x ($%04x byte%s) [\"%s\"]\n", - sect->org, sect->org + sect->size - 1, sect->size, - sect->size == 1 ? "" : "s", sect->name); + if (sect->size != 0) + fprintf(mapFile, " SECTION: $%04x-$%04x ($%04x byte%s) [\"%s\"]\n", + sect->org, sect->org + sect->size - 1, + sect->size, sect->size == 1 ? "" : "s", + sect->name); + else + fprintf(mapFile, " SECTION: $%04x (0 bytes) [\"%s\"]\n", + sect->org, sect->name); for (size_t i = 0; i < sect->nbSymbols; i++) fprintf(mapFile, " $%04x = %s\n",