shithub: rgbds

Download patch

ref: f2be601a137a145e7b56bb8c40768820d8cdd536
parent: 4d2379b3dff221b11302ec51ef69be3f53cfd93e
author: ISSOtm <eldredhabert0@gmail.com>
date: Mon Feb 3 15:57:12 EST 2020

Check "left" boundary as well in `isLocationSuitable`

"fixed" and "aligned" location checking advanced the target location to places
regardless of the associated free space, potentially breaking the assumption
that the location was always further in memory than the free space's base.

Rather than adding more code to try keeping that assumption true, harden
`isLocationSuitable` and handle that case as well.

--- a/src/link/assign.c
+++ b/src/link/assign.c
@@ -135,6 +135,8 @@
 	if (section->isAlignFixed && location->address & section->alignMask)
 		return false;
 
+	if (location->address < freeSpace->address)
+		return false;
 	return location->address + section->size
 					<= freeSpace->address + freeSpace->size;
 }