mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Assign section locations to all UNIONs/FRAGMENTs
Fixes the test case from #800 The `out.gb` output was corrected, since the two "test" fragments have a different order in ROM than in SRAM. It is effectively: ; ROM0[$0000], fragments ordered by size jr Label dw Label db 0 ; SRAM[$a000], fragments ordered by .o order ds 1 ; db 0 ds 2 ; jr Label Label: ; $a003 ds 2 ; dw Label
This commit is contained in:
@@ -112,6 +112,13 @@ static inline void assignSection(struct Section *section,
|
||||
section->org = location->address;
|
||||
section->bank = location->bank;
|
||||
|
||||
// Propagate the assigned location to all UNIONs/FRAGMENTs
|
||||
// so `jr` patches in them will have the correct offset
|
||||
for (struct Section *next = section->nextu; next != NULL; next = next->nextu) {
|
||||
next->org = section->org;
|
||||
next->bank = section->bank;
|
||||
}
|
||||
|
||||
nbSectionsToAssign--;
|
||||
|
||||
out_AddSection(section);
|
||||
|
||||
Reference in New Issue
Block a user