On Thu, 21 Jul 2011 11:13:00 -0700
Ian Lance Taylor <i...@google.com> wrote:

> Jakub Jelinek <ja...@redhat.com> writes:
> 
> > On Thu, Jul 21, 2011 at 08:51:46AM -0700, Ian Lance Taylor wrote:
> >> Basile Starynkevitch <bas...@starynkevitch.net> writes:
> >> 
> >> > I have a similar issue in the MELT branch, and I am passing to 
> >> > -frandom-seed the md5sum
> >> > of relevant source files. With such a trick, the seed is reproducible 
> >> > from one build to
> >> > the next one (of the exact same source tree), and does provide much more 
> >> > randomness than
> >> > just using 0 all the time.
> >> 
> >> In practice I think it is fine to just pass the source file name to
> >> -frandom-seed.  That's what the patch I sent out does.  The source file
> >> name should be unique within a given program.
> >
> > Isn't the filename already encoded in what get_file_function_name returns?
> > It is <filename>_<weak_var_name_crc32>_<random_seed_crc32>, so IMHO
> > -frandom-seed=$@ brings almost no advantages at all over -frandom-seed=0.
> > Except perhaps for the characters from the filename that are
> > wiped into _ by clean_symbol_name.
> 
> That's a fair point, but I guess I still think using the file name with
> -frandom-seed is going to be more future-proof against other users of
> random numbers.

Using the md5sum of the file is probably not bad neither. I would understand 
that you
find it being perhaps too complex for your need, but it is much more random 
than just the
file name (because the md5sum changes with the file content).

Cheers.


-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Reply via email to