shithub: rgbds

Download patch

ref: 38a372f25f3a44b127cad45e5299743a15503f6c
parent: 2e6f5ac679b6fec430023a1527fb4d4f9a8bfc82
author: ISSOtm <[email protected]>
date: Sun Sep 8 19:59:15 EDT 2019

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.

--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -155,6 +155,11 @@
 
 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))) {