Problem with structure alignment on MPC

Michael Svetlik m.svetlik@ssi-schaefer-peem.com
Thu May 8 06:54:00 GMT 2003


Daniel,

just a remark, about my experiences with a H8-cross-gcc: if you declare a 
public symbol (visible to all other modules), gcc locates this item in a 
COMMON section (usually .bss, I think). Symbols belonging to one source code
file are grouped close to each other, just with the restriction of the CPU's 
memory access constraint, but: those groups of symbols are page aligned (on 
H8 0x10).

I think, there are 2 solutions, to solve your problem:
tell gcc '--no-common', so all - even public references - will be located in 
.bss, as close as possible, or
declare your test1 'static' (that's cleaner coding, AFAISI)

mvB, Michael

On Wednesday 07 May 2003 15:39, Daniel Lidsten wrote:
> > What happens if you do this?  (I'd try myself, but my MPC compiler is
> > down at the moment!):
> >
> > struct block test1 __attribute__((aligned(2)));
>
> It doesnt matter what i write when allocating the structure. I have
> tried the numbers 2,4,8 in the row above but the alignment in the memory
> is always 8. It seems like the __attribute__ specifies after the
> allocation of a variable is ignored.
>
> Regards, Daniel
>
> ------
> Want more information?  See the CrossGCC FAQ,
> http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sources.redhat.com


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list