Yes, opts-global.c fills flag_random_seed with string passed in command line. 
But init_random_seed in toplev.c is the one that processes the flag and set 
random_seed variable, which is returned by get_random_seed function. 

By default, my configuration enables LTO. How to test LTO bootstrap? 

Bingfeng

> -----Original Message-----
> From: Richard Biener [mailto:richard.guent...@gmail.com]
> Sent: 30 July 2014 08:47
> To: Bingfeng Mei; Andi Kleen
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] PR61868
> 
> On Tue, Jul 29, 2014 at 3:01 PM, Bingfeng Mei <b...@broadcom.com> wrote:
> > Hi,
> > Please find the patches for pr61868. The problem is that even with -
> frandom-seed gcc always uses 0 instead of specified number/string for
> places such as lto section names. init_random_seed is never called with
> -frandom-seed. Bootstrapped and tested on x86-64. OK for trunk?
> 
> Hmm, but -frandom-seed= is honored by opts.c calling set_random_seed?
> 
> Andi, wasn't this used to support partial linking of LTO objects?  Thus,
> this shortcut was on purpose?  Otherwise passing -frandom-seed to
> LTO would break that?
> 
> Bingfeng, did you test if LTO bootstrap still works after this patch?
> 
> Thanks,
> Richard.
> 
> > Thanks,
> > Bingfeng Mei
> >
> >
> > ===================================================================
> > --- ChangeLog   (revision 213152)
> > +++ ChangeLog   (working copy)
> > @@ -1,3 +1,9 @@
> > +2014-07-29  Bingfeng Mei <b...@broadcom.com>
> > +
> > +       PR lto/61868
> > +       * toplev.c (init_random_seed): Generate random seed when
> > +       flag_random_seed is specified.
> > +
> >  2014-07-28  Jan Hubicka  <hubi...@ucw.cz>
> >
> >         * cgraph.c (cgraph_node::create_indirect_edge): Copy
> speculative data.
> > Index: toplev.c
> > ===================================================================
> > --- toplev.c    (revision 213152)
> > +++ toplev.c    (working copy)
> > @@ -301,7 +301,7 @@ init_random_seed (void)
> >  HOST_WIDE_INT
> >  get_random_seed (bool noinit)
> >  {
> > -  if (!flag_random_seed && !noinit)
> > +  if (!noinit)
> >      init_random_seed ();
> >    return random_seed;
> >  }
> > Index: testsuite/ChangeLog
> > ===================================================================
> > --- testsuite/ChangeLog (revision 213152)
> > +++ testsuite/ChangeLog (working copy)
> > @@ -1,3 +1,8 @@
> > +2014-07-29  Bingfeng Mei  <b...@broadcom.com>
> > +
> > +       PR lto/61868
> > +       * gcc.dg/pr61868.c: New test.
> > +
> >  2014-07-28  Richard Biener  <rguent...@suse.de>
> >
> >         PR rtl-optimization/61801
> > Index: testsuite/gcc.dg/pr61868.c
> > ===================================================================
> > --- testsuite/gcc.dg/pr61868.c  (revision 0)
> > +++ testsuite/gcc.dg/pr61868.c  (revision 0)
> > @@ -0,0 +1,9 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-flto -frandom-seed=0x12345" }  */
> > +extern int foo (int);
> > +int main ()
> > +{
> > +  foo (100);
> > +  return 0;
> > +}
> > +/* { dg-final { scan-assembler "\.gnu\.lto.*.12345" } } */
> >

Reply via email to