mingw hosted arm-elf output differs from linux hosted arm-elf when compiling with -Os

info.gnu@rt-labs.com info.gnu@rt-labs.com
Fri Apr 3 05:19:00 GMT 2009


Hello,

I've built two arm-elf compilers with gcc-4.2.2, both configurations are the
same except build != host differs for mingw since we build both on Ubunutu
linux.

Mingw hosted canadian-cross:

Configured with: ../gcc-4.2.2/configure --target=arm-elf
--prefix=/proj/crossgcc/arm-elf-mingw --disable-nls --with-gnu-as
--with-gnu-ld --enable-languages=c,c++ --with-newlib
--with-headers=../newlib-1.17.0/newlib/libc/include --disable-shared
--disable-threads --disable-libssp --disable-__cxa_atexit
--disable-libstdcxx-pch --build=x86_64-unknown-linux-gnu
--host=i686-pc-mingw32 --enable-interwork --enable-multilib
Thread model: single
gcc version 4.2.2 (rt-labs rev.1728M)

Linux hosted:

Configured with: ../gcc-4.2.2/configure --target=arm-elf
--prefix=/proj/crossgcc/arm-elf --disable-nls --with-gnu-as --with-gnu-ld
--enable-languages=c,c++ --with-newlib
--with-headers=../newlib-1.17.0/newlib/libc/include --disable-shared
--disable-threads --disable-libssp --disable-__cxa_atexit
--disable-libstdcxx-pch --enable-interwork --enable-multilib
Thread model: single
gcc version 4.2.2 (rt-labs rev.1728M)


In our unit-tests (that passes for both variants) we have the following isr
that cause a difference in output, other functions differ as well. I've
noticed that static variables and functions seem to be used when it appears.


static void isr1 (void * arg)
{
   /* Clear high priority IRQ */
   pSIC->soft_clear = BIT(0);
   
   if (isr0run == 1)
      isrOutOfOrder = 1;
   
   isr1run = 1;
}

I've used "arm-elf-objdump -d isr.o > dump" -> to produce the following. 

Mingw output :

Disassembly of section .text.isr1:

00000000 <isr1>:
   0:	23ca      	movs	r3, #202
   2:	061b      	lsls	r3, r3, #24
   4:	2201      	movs	r2, #1
   6:	615a      	str	r2, [r3, #20]
   8:	4b04      	ldr	r3, [pc, #16]	(1c <isr1+0x1c>)
   a:	681b      	ldr	r3, [r3, #0]
   c:	2b01      	cmp	r3, #1
   e:	d101      	bne.n	14 <isr1+0x14>
  10:	4b03      	ldr	r3, [pc, #12]	(20 <isr1+0x20>)
  12:	601a      	str	r2, [r3, #0]
  14:	4b03      	ldr	r3, [pc, #12]	(24 <isr1+0x24>)
  16:	601a      	str	r2, [r3, #0]
  18:	4770      	bx	lr
  1a:	46c0      	nop			(mov r8, r8)
	...
Linux output :

Disassembly of section .text.isr1:

00000000 <isr1>:
   0:	4b05      	ldr	r3, [pc, #20]	(18 <isr1+0x18>)
   2:	2201      	movs	r2, #1
   4:	615a      	str	r2, [r3, #20]
   6:	4b05      	ldr	r3, [pc, #20]	(1c <isr1+0x1c>)
   8:	681b      	ldr	r3, [r3, #0]
   a:	2b01      	cmp	r3, #1
   c:	d101      	bne.n	12 <isr1+0x12>
   e:	4b04      	ldr	r3, [pc, #16]	(20 <isr1+0x20>)
  10:	601a      	str	r2, [r3, #0]
  12:	4b04      	ldr	r3, [pc, #16]	(24 <isr1+0x24>)
  14:	601a      	str	r2, [r3, #0]
  16:	4770      	bx	lr
  18:	ca000000 	.word	0xca000000
	...

Is there a sane explanation why they differ? When compiling without Os the
output is the same. I would prefer that they didn't differ even though
optimizing is used.

Regards Andreas
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3983 (20090402) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3984 (20090402) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 



More information about the Gcc-help mailing list