align _END label, add ALIGN directive to assembler

- fixes failing memory allocator when _END label is not aligned
This commit is contained in:
slederer 2025-11-05 00:30:49 +01:00
parent 0f72080c56
commit 87ec71bd6d
2 changed files with 6 additions and 1 deletions

View file

@ -324,7 +324,9 @@ begin
rewindStringList(usedUnits); rewindStringList(usedUnits);
while nextStringListItem(usedUnits, unitName) do while nextStringListItem(usedUnits, unitName) do
emitInclude(unitName + UnitSuffix2); emitInclude(unitName + UnitSuffix2);
(* _END label needs to be word-aligned because
it is used as the start of the heap *)
emitIns('.ALIGN');
emitLabelRaw('_END'); emitLabelRaw('_END');
end; end;

View file

@ -2056,6 +2056,9 @@ begin
operandValue := 0; operandValue := 0;
emitBlock(count, operandValue); emitBlock(count, operandValue);
end end
else
if lastToken.tokenText6 = '.ALIGN' then
alignOutput(wordSize)
else else
errorExit2('Unrecognized directive', lastToken.tokenText); errorExit2('Unrecognized directive', lastToken.tokenText);
end; end;