On Jul 20, 2011, at 1:25 PM, Ian Lance Taylor wrote:
> Interesting.  I don't know why this doesn't happen on GNU/Linux.

It doesn't happen as the symbols in question are local on linux.  collect2 runs 
nm on public symbols looking for symbols of a particular form, it then builds 
two lists, one for constructors of global objects (simplistic view) and one for 
destructors.  a.out systems liked doing this sort of things as well.  On more 
modern OSes, the constructors and destructors hook into crt code that can run 
per translation unit initializations, for example on elf, one might use .init 
to achieve this.  When one uses one of these more advanced features to hook 
into the OS, then the symbols no longer need to be public and the port is 
changed to make them non-public.

> Presumably the fix will be to use -frandom-seed.

But, the random seem was to ensure that things that should not collide, don't.  
If you use 0, then things that should not collide, eventually will and your 
world with then end.  In the present code base, it is perfectly safe to do 
this.  If the codebase is ever extended to use C++ features, then, that code 
can break.

Reply via email to