Problem running/compiling bird for ARM

Radoslaw Kamil Ejsmont radoslaw at ejsmont.net
Mon Nov 3 09:37:50 CET 2014


Hi guys,

Just noticed this was already fixed in master. And forcing struct alignment does fix the issue on ARM - no need to work on bitwise operators.
Thanks!

Best,

Radek


-- 
Radoslaw Kamil Ejsmont, Ph.D.
http://radoslaw.ejsmont.net

> On 02 Nov 2014, at 23:21, Radoslaw Kamil Ejsmont <radoslaw at ejsmont.net> wrote:
> 
> Hi,
> 
> I did a bit of research on the error. I have added the following lines to dbdes.c in ospf_dbdes_receive function
> 
> -— SNIP --
> unsigned int size = ntohs(ps_i->length);
> /* log sizes */
> log(L_ERR "OSPF DBDES packet is (%u B)", n->ip, size);
> log(L_ERR "OSPF DBDES packet should be (%u B)", sizeof(struct ospf_dbdes_packet));
> log(L_ERR "OSPF packet should be (%u B)", sizeof(struct ospf_packet));
> log(L_ERR "IMMS should be (%u B)", sizeof(union imms));
> log(L_ERR "Size of u8 %u", sizeof(u8));
> log(L_ERR "Size of u16 %u", sizeof(u16));
> log(L_ERR "Size of u32 %u", sizeof(u32));
> log(L_ERR "Size of u64 %u", sizeof(u64));
> log(L_ERR "Size of char %u", sizeof(char));
> log(L_ERR "Size of short int %u", sizeof(short int));
> log(L_ERR "Size of int %u", sizeof(int));
> log(L_ERR "Size of long int %u", sizeof(long int));
> log(L_ERR "Size of long long int %u", sizeof(long long int));
> -— SNIP —
> 
> This is the result on my 32-bit ARM router:
> 
> Nov  2 21:38:35 router-2 daemon.err bird6: OSPF DBDES packet is (28 B)
> Nov  2 21:38:35 router-2 daemon.err bird6: OSPF DBDES packet should be (32 B)
> Nov  2 21:38:35 router-2 daemon.err bird6: OSPF packet should be (16 B)
> Nov  2 21:38:35 router-2 daemon.err bird6: IMMS should be (4 B)
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of u8 1
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of u16 2
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of u32 4
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of u64 8
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of char 1
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of short int 2
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of int 4
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of long int 4
> Nov  2 21:38:35 router-2 daemon.err bird6: Size of long long int 8
> 
> 
> This is the result on 64-bit ubuntu 14.04 machine:
> 
> 2014-11-02 22:57:14 <ERR> OSPF DBDES packet is (4269801472 B)
> 2014-11-02 22:57:14 <ERR> OSPF DBDES packet should be (28 B)
> 2014-11-02 22:57:14 <ERR> OSPF packet should be (16 B)
> 2014-11-02 22:57:14 <ERR> IMMS should be (1 B)
> 2014-11-02 22:57:14 <ERR> Size of u8 1
> 2014-11-02 22:57:14 <ERR> Size of u16 2
> 2014-11-02 22:57:14 <ERR> Size of u32 4
> 2014-11-02 22:57:14 <ERR> Size of u64 8
> 2014-11-02 22:57:14 <ERR> Size of char 1
> 2014-11-02 22:57:14 <ERR> Size of short int 2
> 2014-11-02 22:57:14 <ERR> Size of int 4
> 2014-11-02 22:57:14 <ERR> Size of long int 8
> 2014-11-02 22:57:14 <ERR> Size of long long int 8
> 
> 
> I think that for some reason the ARM gcc () interprets this struct
> 
> struct immsb
> {
> #ifdef CPU_BIG_ENDIAN
>  u8 padding:5;
>  u8 i:1;
>  u8 m:1;
>  u8 ms:1;
> #else
>  u8 ms:1;
>  u8 m:1;
>  u8 i:1;
>  u8 padding:5;
> #endif
> };
> 
> as 4 byte struct, instead of 1 byte subdivided into bit-long parts.
> 
> This is the GCC version:
> 
> # arm-linux-uclibc-gcc -v
> Reading specs from /home/rejsmont/src/optware/mbwe-bluering/toolchain/mbwe-bluering-buildroot/build_arm_nofpu/staging_dir/lib/gcc/arm-linux-uclibc/3.4.2/specs
> Configured with: /home/rejsmont/src/optware/mbwe-bluering/toolchain/mbwe-bluering-buildroot/toolchain_build_arm_nofpu/gcc-3.4.2/configure --prefix=/home/rejsmont/src/optware/mbwe-bluering/toolchain/mbwe-bluering-buildroot/build_arm_nofpu/staging_dir --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c,c++ --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-threads --enable-multilib --with-float=soft
> Thread model: posix
> gcc version 3.4.2
> 
> 
> Once again thanks in advance for help!
> 
> 
> Best,
> 
> Radek
> 
> -- 
> Radoslaw Kamil Ejsmont, Ph.D.
> http://radoslaw.ejsmont.net
> 
> 




More information about the Bird-users mailing list