Re: -frandom-seed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Morrell <morrell@xxxxxxxxxxxxxxx> writes:

> I want g++ to produce an identical binary when given the same source.
> If I don't use __DATE__ or __TIME__, I believe this will happen with
> one exception.  Certain symbols get a randomly created component in
> their names which I can eliminate using an option like
> -frandom-seed=0.
>
> However, the man page wasn't clear as to why this option was needed and made
> me a little nervous anout using it.  Can someone give me a test case where
> using -frandom-seed will break things?

With gcc 4.3 and later I think it's pretty hard to break things using
-frandom-seed, as gcc now turns functions defined in anonymous
namespaces into static symbols.  You may be able to confuse the debugger
by having multiple static functions with the same name.

Anyhow, you will always be safe if you compile each file using a
different value for -frandom-seed.  The easiest way to do that is to use
the filename itself as the seed.  The random seed can be any string.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux