Gale Paeper gpaeper at empirenet.com
Mon Mar 10 15:10:09 CET 2003

Adriaan van Os wrote:
> Peter N Lewis wrote:

> > What is needed is a relaxation of the alignment restrictions when
> > building a record, without the onerous restriction of bitfield
> > packing.  Presumably this would help with Borland compatibility as
> > well.
> >
> > Basically, we need something like --record-alignment={1,2,4} (and a
> > corresponding compiler directive we can add to the system interfaces)
> > so that items N bytes or larger are aligned to N bytes (where N is 1 2
> > or 4).
> >
> > If this sounds reasonable, and if folks have advice on the exact user
> > interface for this, then I'm willing to take a crack at this in the
> > source to "get my feet wet".
> >
> > Specific advice would include the exact name "record-alignment",
> > whether it should take a parameter, or instead be
> > --no-record-alignment, --record-alignment1, --record-alignment2,
> > --record-alignment4.  The latter would seem more in keeping with the
> > options in general, as I could not find any other compiler directive
> > that took a parameter, but correct me if I'm wrong.
> --record-alignment=n (where n=0, 1, 2, 4)
> > Without this, it'll be *very* challenging to get the Mac Pascal
> > interfaces working, as many of them date back to the '80s on a 68000
> > which had generally 2 byte alignment.
> --pack-struct is a gcc option, not a gpc option, so I wonder if packing
> is a front-end or a back-end issue. I hope Frank knows. The Apple
> version of gcc (front-end or back-end) has the following options:
> malign-mac68k, -malign-power and -malign-natural.

If there is a way to get C pragma's passed through from Pascal source
code, Apple's "#pragma options align={mac68k|power|reset}"
implementation is in file darwin-c.c located in the gcc/config directory
of the GPC Mac OS X build source you are distributing from your GPC web
page.  In essense, all that is required to get mac68k alignment is to
set maximum_field_alignment = 16 and for power alignment set
maximum_field_alignment = 0.  Apple's pragma code just maintains a
save/restore stack and makes the appropriate assignment to
maximum_field_alignment.  (A batch file search on the sources will
reveal maximum_field_alignment is used in stor-layout.c for field
alignment for struct/record type layouts.)
If some sort of C pragma pass through isn't possible from Pascal source
code, I suggest that the record alignment solution be compatible with
Apple's solution which is in turn compatible gcc's general storage
layout pragmas.  That way we can piggyback off of Apple's efforts in
maintaining mac68k and power record alignment working in gcc for Mac OS X.

Gale Paeper
gpaeper at empirenet.com

More information about the Gpc mailing list