Subject: Re: Weirdness with ELF bootblocks
To: None <thorpej@zembu.com>
From: Simon Burge <simonb@wasabisystems.com>
List: port-hp300
Date: 02/26/2001 11:54:37
[ blah - this got lost in my inbox ]
Jason R Thorpe wrote:
> On Tue, Feb 13, 2001 at 11:58:37PM +1100, Simon Burge wrote:
>
> > Index: rominfo.h
> > ===================================================================
> > RCS file: /cvsroot/syssrc/sys/arch/hp300/stand/common/rominfo.h,v
> > retrieving revision 1.1
> > diff -d -p -u -r1.1 rominfo.h
> > --- rominfo.h 1997/02/04 03:52:49 1.1
> > +++ rominfo.h 2001/02/13 12:54:17
> > @@ -47,7 +47,7 @@
> > struct jmpvec {
> > short op; /* jmp instruction */
> > long addr; /* address */
> > -};
> > +} __attribute__((__packed__));
>
> This one is obviously correct.
Cool.
> > struct rominfo {
> > char p1[0xDC0];
> > @@ -65,4 +65,4 @@ struct rominfo {
> > char p6; /* ?? (FFFFFEDB) */
> > long msus; /* ?? (FFFFFEDC) */
> > struct jmpvec jvec[48]; /* jump vectors (FFFFFEE0) */
> > -};
> > +} __attribute__((__packed__));
>
> You might want to see how the a.out compiler padded this one (not sure
> what happens to the "char" -- I'm pretty sure it's packed in a.out, but
> you might want to make sure...)
Judging by the comment it is packed, but I don't have any m68k a.out
boxes on which to check. Can anyone else verify this before I commit
the change? Something like:
struct foo {
char c1;
int i1;
} /* __attribute__((__packed__)) */;
main()
{
printf("sizeof = %d\n", sizeof(struct foo));
exit(0);
}
should print "5" for a packed structure and "6" (or "8"?) for an padded
structure.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD CDs, Support and Service: http://www.wasabisystems.com/