[arm-gnu] gcc-arm Compiler produce different object file for the same source file

Gene Smith gds at chartertn.net
Mon Jun 17 03:36:05 UTC 2013


On 06/12/2013 11:59 AM, Abdurahman Alfeky wrote:
> Hi All ,
>
> Have anyone face the following problem before:
>
> Using the GCC compiler for ARM (windows) :
>
>     /arm-none-eabi-gcc.exe (Sourcery CodeBench Lite 2012.09-63) 4.7.2/
>     version
>
> I have got different object file produced every ~5 times i compiled the
> same source file.
>
> The optimization level 3 is used (aggressive) is used, compiler options
> used:
>
>     -O3 -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -fshort-wchar
>     -fshort-enums  -funsafe-math-optimizations -mvectorize-with-neon-quad
>
> The dump of the different object files shows too many differences in
> assembly instructions , registers and addresses used.
>
>   *
>
>     Is it normal that compiler optimize/compile exactly the same source
>     file differently and produce different object files ?! is it a
>     compiler bug ?
>
>   *
>
>     How to avoid this behavior without turning off aggressive optimization ?
>
> Thanks
>
> --
> Abdurahman Alfeky,
> Software Engineer
>

Tried with latest CS lite eabi version 4.7.3 and don't see a problem. 
After linking big cortex-m3 pgm I object dump the elf to ihex file. Then 
run a md5 checksum on the ihex file and it is always the same md5 value 
even after 6+ "make clean all" runs. But not same options (or processor) 
and not 4.7.2 so just a data point and not an exact comparison, so still 
may be a bug.




More information about the arm-gnu mailing list