From 38a372f25f3a44b127cad45e5299743a15503f6c Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sun, 8 Sep 2019 23:59:15 +0200 Subject: [PATCH] Allow 0-byte SECTIONs to be fixed anywhere They do not take any room, so they can only be used to define symbols at a given location. I ran into trouble with such a SECTION failing to be placed where specified, which doesn't make sense. This way, it also makes sense to have such a SECTION in the middle of another one, but that should be fine, since there's no actual overlap. --- src/link/assign.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/link/assign.c b/src/link/assign.c index 0d4ccbf5..5c31ebbf 100644 --- a/src/link/assign.c +++ b/src/link/assign.c @@ -155,6 +155,11 @@ int32_t area_Avail(int32_t bank) int32_t area_doAlloc(struct sFreeArea *pArea, int32_t org, int32_t size) { + if (size == 0) { + /* 0-byte SECTIONs don't take any room, they can go anywhere */ + return org; + } + if ((org >= pArea->nOrg) && ((org + size) <= (pArea->nOrg + pArea->nSize))) {