Skip to contentSkip to conversation

gcc

DISCUSSION David Rundle 2 participants 2 messages Sep 4, 2001

lore
Share & tools
lore
#0 lore raw

hi i need help i have a data struct that matchs some hardwear but gcc is alignin it this meins it is out of sync whit the hardwear like
char is 2 bytes
long double is 12 bytes
will thats what gcc thinks

so i need to tell gcc not to align the data struct

may be like

noalign struct ........

the main prob is whit long double st[8]

gcc make long double 12 bytes when it need to be 10 bytes

think you

struct _i386_fpu_st
{
long long significand;
unsigned char exponent ;
/* unsigned long test ; */

} ;

struct _i386_fpu
{
unsigned short control ;

  unsigned short rev0    ; 
  unsigned short status  ; 
  unsigned short rev1    ; 
  unsigned short tag     ; 
  unsigned short rev2    ; 

unsigned long instructionPointer ;
unsigned short instructionSelector ;
unsigned short opcode ;
unsigned long operandPointer ;
unsigned short operandSelector ;
unsigned short rev3 ;
long double st[8] ;

/* struct _i386_fpu_st st[8] ; */

  unsigned long rev[400] ; 

} ;

extern struct _i386_fpu * i386_fpuInit(void) ;

#1 lore raw
Quoted 10 lines · David Rundle

hi i need help i have a data struct that matchs some hardwear but gcc is alignin it this meins it is out of sync whit the hardwear like
char is 2 bytes
long double is 12 bytes
will thats what gcc thinks

so i need to tell gcc not to align the data struct

may be like

__attribute__((packed))

Regards,

Signature · 4 lines
Kurt Garloff                   <[email protected]>         [Eindhoven, NL]
Physics: Plasma simulations  <[email protected]>  [TU Eindhoven, NL]
Linux: SCSI, Security          <[email protected]>    [SuSE Nuernberg, DE]
 (See mail header or public key servers for PGP2 and GPG public keys.)