[U-Boot-Users] [PATCH v2] tools/envcrc.c: use the target sizeof rather than build

Mike Frysinger vapier at gentoo.org
Mon Mar 31 15:58:26 CEST 2008


On Monday 31 March 2008, Wolfgang Denk wrote:
> In message <200803302142.18994.vapier at gentoo.org> you wrote:
> > The envcrc.c does sizeof(unsigned long) when calculating the crc, but
> > this is done with the build toolchain instead of the target toolchain, so
> > if the build is a 64bit system but the target is 32bits, the size will
> > obviously be wrong.  This introduces a sizeof.sh script to calculate the
> > required sizeof() value of any type with any compiler.
> >
> > Signed-off-by: Mike Frysinger <vapier at gentoo.org>
> > ---
> > Changes:
> >  - adds copyright/license
> >  - increase limit to 512
> >  - increment by 4 bytes to find "32bit naturals" faster:
> > (old/new # = number of times gcc is called)
> > type	| sizeof	| old	| new
> > char	| 1	| 1	| 5
> > short	| 2	| 2	| 4
> > int	| 4	| 4	| 2
> > long	| 8	| 8	| 3
> > double	| 8	| 8	| 3
>
> Sorry, but I still think this is serious overkill which just slows down
> the build process.

two or three executions of gcc will not affect the overall build speed in any 
way (which is what i proposed).

> We need exactly one single case of  this,  i.  e.  sizeof(long).

which is what you get.  i posted the numbers only as reference, not because 
gcc actually gets executed that many times.

> And 
> instead  of  tricking  around all this here, I think we should rather
> use somthing like "u32" in the code.

if the value in question represents a CRC32, then that's what should have been 
used in the first place ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080331/d371697a/attachment.pgp 


More information about the U-Boot mailing list