[arm-gnu] gcc-arm Compiler produce different object file for the same source file
Abdurahman Alfeky
abdurahman.alfeky at gmail.com
Thu Jun 13 09:47:41 UTC 2013
there is no chnagein source code , and there no use of __DATE__ or time
macros , no regenerated headers and by looking into the output of objdump
on object file which is compiled without debugging information i can see
too many differences in assembly instructions. i heard about using
-frandom-seed=string to avoid this but it is not clear how the compiler
deal with it ?
copied from man page "
http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html"
> -frandom-seed=stringThis option provides a seed that GCC uses in place of
> random numbers in generating certain symbol names that have to be different
> in every compiled file. It is also used to place unique stamps in coverage
> data files and the object files that produce them. You can use the
> -frandom-seed option to produce reproducibly identical object files.
>
> The string should be different for every file you compile
>
On Thu, Jun 13, 2013 at 9:30 AM, David Brown <david at westcontrol.com> wrote:
> On 12/06/13 17:59, 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
> >
>
> There are usually differences in the object file, because it includes
> things like compilation date in the debugging information. But I don't
> think you should get differences in the actual generated code. Are you
> sure there is nothing changing, like headers, use of __DATE__ macros,
> etc.? Minor changes in the source code can sometimes lead to apparently
> large changes in the object code such as different register choices or
> different ordering of code (the behaviour of such code is identical, but
> it can look very different).
>
> If you are looking at the final linked code, then remember that the
> order of the object files in the link can often affect the order of the
> generated code.
>
>
> _______________________________________________
> arm-gnu mailing list
> arm-gnu at codesourcery.com
> http://sourcerytools.com/cgi-bin/mailman/listinfo/arm-gnu
>
--
Abdurahman Alfeky,
Software Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20130613/b1ec0a27/attachment.html>
More information about the arm-gnu
mailing list