From e27da737c6aca9659458d95c32d606ebbea7380c Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Thu, 14 Apr 2022 23:58:32 +0200 Subject: [PATCH] Print name of up to 10 floating sections on overlay error --- src/link/assign.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/link/assign.c b/src/link/assign.c index dfad2b8f..5f25d3fd 100644 --- a/src/link/assign.c +++ b/src/link/assign.c @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -446,9 +447,27 @@ void assign_AssignSections(void) /* Overlaying requires only fully-constrained sections */ verbosePrint("Assigning other sections...\n"); - if (overlayFileName) - errx("All sections must be fixed when using an overlay file; %" PRIu64 " %sn't", - nbSectionsToAssign, nbSectionsToAssign == 1 ? "is" : "are"); + if (overlayFileName) { + fprintf(stderr, "FATAL: All sections must be fixed when using an overlay file"); + uint8_t nbSections = 0; + for (int8_t constraints = BANK_CONSTRAINED | ALIGN_CONSTRAINED; constraints >= 0; constraints--) { + for (sectionPtr = unassignedSections[constraints]; + sectionPtr; + sectionPtr = sectionPtr->next) { + fprintf(stderr, "%c \"%s\"", + nbSections == 0 ? ';': ',', sectionPtr->section->name); + nbSections++; + if (nbSections == 10) + goto max_out; + } + } + +max_out: + if (nbSectionsToAssign != nbSections) + fprintf(stderr, " and %" PRIu64 " more", nbSectionsToAssign - nbSections); + fprintf(stderr, " %sn't\n", nbSectionsToAssign == 1 ? "is" : "are"); + exit(1); + } /* Assign all remaining sections by decreasing constraint order */ for (int8_t constraints = BANK_CONSTRAINED | ALIGN_CONSTRAINED;