public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* egcs and bitfields
@ 1999-03-11 14:33 David A. Greene
       [not found] ` < 36E844B2.8DAEFAAF@eecs.umich.edu >
  1999-03-31 23:46 ` David A. Greene
  0 siblings, 2 replies; 24+ messages in thread
From: David A. Greene @ 1999-03-11 14:33 UTC (permalink / raw)
  To: egcs

I sent this question to the list a few days ago but got
no response.  Can someone please help me out?

I'm trying to figure out the alignment rules that egcs 
uses for bitfields under Linux 2.0.x.  It seems that egcs 
does not follow the System V ABI stardard.  Specifically, 
the part about not allowing bitfields to cross the 
alignment boundaries of their base types (i.e. int c:17 
should not cross a 32-bit boundary, but egcs allows it).  
Also, bitfields declared "int" are treated as signed by 
egcs while the System V ABI indicates they are unsigned.

What ABI is egcs conforming to?  I need some detailed 
information as we need to interface to code compiled by
egcs.

Thanks!

                                -Dave

^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: egcs and bitfields
@ 1999-03-12  7:20 David A. Greene
  1999-03-31 23:46 ` David A. Greene
  0 siblings, 1 reply; 24+ messages in thread
From: David A. Greene @ 1999-03-12  7:20 UTC (permalink / raw)
  To: egcs

Robert Lipe wrote:
> 
> > struct baz { unsigned int a:2, b:4, c:32;} y;
> >
> > void foo()
> > {
> >   y.c = 0x56789;
> > }
> >
> > int main()
> > {
> >   unsigned int  *b;
> >   bzero(&y,sizeof(y));
> >   foo();
> >   b=&y;
> >   printf("%x %x\n",b[0],b[1]);
> > }
> >
> > Is this the case you are talking about? Now, you claim that the SysV
> > ABI requires y.c to be at offset 4, right? (this is a claim I can't
> > verify since I don't have that specification)
> 
> "System V ABI" is too vague for purposes of this discussion.  Do you
> refer to the iBCS2 spec or the SVR4 ABI?  I don't know that they differ
> in this regard, but it isn't an unreasonable question before tearing
> into large books.

Good question.  The book I have here is the "System V ABI Intel386
Processor Supplement" put out by AT&T in 1991 (yes, I know it's old,
but it's all we've got).  It is the SVR4 ABI.  Please correct me 
if there's a more up-to-date version I should be looking at.
 
> I think (but am no authority) that Linux uses substantially the SVR4 ABI
> but it does have some deviations.

Do you know what these deviations are?  The devil is in the details. :)

                                           -Dave

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~1999-03-31 23:46 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-11 14:33 egcs and bitfields David A. Greene
     [not found] ` < 36E844B2.8DAEFAAF@eecs.umich.edu >
1999-03-11 15:14   ` Martin v. Loewis
     [not found]     ` < 199903112300.AAA19947@mira.isdn.cs.tu-berlin.de >
1999-03-11 15:41       ` Robert Lipe
1999-03-31 23:46         ` Robert Lipe
1999-03-12  7:16     ` David A. Greene
     [not found]       ` < 36E92F61.5951621@eecs.umich.edu >
1999-03-12  8:48         ` Robert Lipe
     [not found]           ` < 19990312104540.D1570@rjlhome.sco.com >
1999-03-12  9:41             ` Doug Semler
     [not found]               ` < 199903121741.JAA24401@vortex.seaspace.com >
1999-03-12  9:59                 ` Robert Lipe
1999-03-31 23:46                   ` Robert Lipe
1999-03-12 13:26                 ` Martin v. Loewis
     [not found]                   ` < 199903122118.WAA00520@mira.isdn.cs.tu-berlin.de >
1999-03-12 13:52                     ` Doug Semler
1999-03-31 23:46                       ` Doug Semler
1999-03-31 23:46                   ` Martin v. Loewis
1999-03-31 23:46               ` Doug Semler
1999-03-31 23:46           ` Robert Lipe
1999-03-12  9:27         ` Martin v. Loewis
1999-03-12 10:47           ` David A. Greene
1999-03-31 23:46             ` David A. Greene
1999-03-31 23:46           ` Martin v. Loewis
1999-03-31 23:46       ` David A. Greene
1999-03-31 23:46     ` Martin v. Loewis
1999-03-31 23:46 ` David A. Greene
1999-03-12  7:20 David A. Greene
1999-03-31 23:46 ` David A. Greene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).