From 317b206fa87f0fe27884eab28e8a5bb44db6ba28 Mon Sep 17 00:00:00 2001 From: AntonioND Date: Wed, 15 Mar 2017 23:52:05 +0000 Subject: [PATCH] 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 --- src/link/mapfile.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/link/mapfile.c b/src/link/mapfile.c index a315ebc0..f60a1170 100644 --- a/src/link/mapfile.c +++ b/src/link/mapfile.c @@ -96,9 +96,14 @@ MapfileWriteSection(struct sSection * pSect) 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) {