Skip to content

AROS: Introduction of stack aligned record fields for 32/64-bit compatibility

magorium requested to merge magorium/fpc-source:AROS-stacked-record-fields into main

AROS introduced STACKED structure members, which are members that are padded according to the current used stacksize which in itself is based on the target CPU.

These structures are required to have a particular defined size in memory and have a particular field alignment, therefor these records are always end-padded (whether required or not) so that we are able to force the compiler to add padding depending on the RECORDMIN setting.

Other available FPC directives and/or solutions seem currently not able to solve that issue and we do not wish to manually check each structure to determine if it requires end-padding or not (based on bitness) simply because it is unmaintainable.

This change attempts to ensure that these record structures compile using the correct memory size and field layout for both 32 and 64-bit CPU's.

The introduction of stack aligned record fields solves a lot of 64-bit related crashes when working with native OS OOP such as MUI and BOOPSI.

Note: Not tested on big endian.

Merge request reports