rgblink adjusts patches' PC offsets when merging FRAGMENTs

Fixes #869
This commit is contained in:
Rangi
2021-05-02 14:57:54 -04:00
committed by Eldred Habert
parent 9ab9d0f39c
commit 296e5489c9
8 changed files with 37 additions and 0 deletions

View File

@@ -165,6 +165,9 @@ static void mergeSections(struct Section *target, struct Section *other, enum Se
if (!target->data)
errx(1, "Failed to concatenate \"%s\"'s fragments", target->name);
memcpy(target->data + target->size - other->size, other->data, other->size);
/* Adjust patches' PC offsets */
for (uint32_t patchID = 0; patchID < other->nbPatches; patchID++)
other->patches[patchID].pcOffset += other->offset;
}
break;