This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Different object code generated each time file is compiled
- From: Brian Dessent <brian at dessent dot net>
- To: Burt Bicksler <bbicksler at fortresstech dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 30 Sep 2008 14:03:51 -0700
- Subject: Re: Different object code generated each time file is compiled
- References: <1222804773.17870.ezmlm@gcc.gnu.org> <48E28BB3.6020902@fortresstech.com>
- Reply-to: gcc-help at gcc dot gnu dot org
Burt Bicksler wrote:
> It is only two source files that we see this difference with and it is
> always 4 bytes in each object file that is different.
>
> Has anyone encountered anything like this before?
There are several things that can cause this. The most common is the
use of the __TIME__ or __DATE__ macros, however this doesn't seem
applicable in your case if you are compiling preprocessed source since
the expansion will have already occurred.
Another less obvious source of differences are anonymous namespaces.
Because the standard says that they must be unique to each translation
unit, the compiler has to add some random strings to their mangled names
to uniquify them so that no two can clash. The -frandom-seed option is
provided as a way for the user to specify their own uniquifier string:
<http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#index-frandom_002dstring-571>
If that doesn't cover your problem then you'll probably have to
investigate further. Try diffing the assembler output (-S) of two runs
and the source of the difference should jump out at you.
Brian