[rrd-developers] portable structs ... more testes

Andreas Maus a.maus at science-computing.de
Tue Jun 26 10:02:25 CEST 2007


On Tue, Jun 26, 2007 at 08:24:24AM +0200, Tobias Oetiker wrote:
> Hi RRDdevelopers,
> 
> I have done some more portability tests. this time with struct
> alignement.
> 
> have a look at
> 
> http://oss.oetiker.ch/rrdtool-trac/wiki/PortableRrdFormat
> 
> so it seems that if the structs are layed out properly the memory
> layout is the same at least on intel/linux and sparc/solaris architectures.
> 
> additional input from other architectures is highly appreciated.
Hi Tobi.

Here we go:

 - MIPS:

maus at octane ~ $ hinv -c processor
1 300 MHZ IP30 Processor
CPU: MIPS R12000 Processor Chip Revision: 2.3
FPU: MIPS R12010 Floating Point Chip Revision: 0.0
maus at octane ~ $ cc -v
MIPSpro Compilers: Version 7.4
maus at octane ~ $ cc -o align ./align.c
maus at octane ~ $ ./align 
struct test non-aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  


struct test aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  

Same with gcc:
maus at octane ~ $ gcc -v
Reading specs from /usr/local/gcc-2.95.3/lib/gcc-lib/mips-sgi-irix6.5/2.95.3/specs
gcc version 2.95.3 20010315 (release)
maus at octane ~ $ gcc -o align align.c 
maus at octane ~ $ ./align 
struct test non-aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  


struct test aligned:
 30 31 32 00   88 88 88 88  fing
 07 5b cd 15   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88 
 
 - Itanium2 IA64:

maus at itanium ~ $ cc -V
(Bundled) cc: HP aC++/ANSI C B3910B A.05.50 [May 15 2003]
maus at itanium ~ $ cc -o align align.c
maus at itanium ~ $ ./align 
struct test non-aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  


struct test aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  

and with gcc:

maus at itanium ~ $ gcc -v
Reading specs from /usr/local/gcc-3.3.4/lib/gcc-lib/ia64-hp-hpux11.22/3.3.4/specs
Configured with: /soft/gcc/gcc-3.3.4/gcc-3.3.4/configure --prefix=/usr/local/gcc-3.3.4 --with-included-gettext --enable-shared --enable-languages=c,c++,f77 --with-gnu-as --enable-libunwind-exceptions
Thread model: single
gcc version 3.3.4
maus at itanium ~ $ gcc -o align align.c
maus at itanium ~ $ ./align 
struct test non-aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  


struct test aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  

 - PA-RISC 64bit:

maus at parisc64 ~ $ gcc -v
Reading specs from /usr/local/gcc-3.3.4/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.4/specs
Configured with: /soft/gcc/gcc-3.3.4/gcc-3.3.4/configure --prefix=/usr/local/gcc-3.3.4 --with-included-gettext --enable-shared --enable-languages=c,c++,f77 --with-gnu-as
Thread model: single
gcc version 3.3.4
maus at parisc64 ~ $ gcc -o align align.c
maus at parisc64 ~ $ ./align 
struct test non-aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 07 5b cd 15   88 88 88 88  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  


struct test aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  

 - PowerPC 64 Bit:

[... snipp ...]
Processor Type: PowerPC_POWER5
Number Of Processors: 2
Processor Clock Speed: 1648 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
[... snipp ...]

maus at aix53 ~ $ /usr/local/gcc-3.3.4/bin/gcc -v
Reading specs from /usr/local/gcc-3.3.4/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.3.4/specs
Configured with: /soft/gcc/gcc-3.3.4/gcc-3.3.4/configure --prefix=/usr/local/gcc-3.3.4 --with-included-gettext --enable-shared --enable-languages=c,c++,f77 -with-cpu-common --disable-multilib
Thread model: aix
gcc version 3.3.4

maus at aix53 ~ $ /usr/local/gcc-3.3.4/bin/gcc -o align align.c
maus at aix53 ~ $ ./align 
struct test non-aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   5b 26 43 5e  
 95 46 ee 81   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  


struct test aligned:
 30 31 32 00   88 88 88 88  
 07 5b cd 15   07 5b cd 15  
 5b 26 43 5e   95 46 ee 81  
 5b 26 43 5e   95 46 ee 81  
 00 00 00 00   07 5b cd 15  
 00 00 00 01   88 88 88 88  

HTH,

Andreas.

-- 
Dipl.-Ing. Andreas Maus             science+computing ag
System Administration               Hagellocher Weg 73
mail: a.maus at science-computing.de   72070 Tuebingen, Germany
tel.: +49 7071 9457 671             www.science-computing.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20070626/43266bac/attachment-0001.bin 


More information about the rrd-developers mailing list