167a168,169
> AddLocalOption('--no-lto', dest='no_lto', action='store_true',
> help='Disable Link-Time Optimization for fast')
479a482,485
> # Initialize the Link-Time Optimization (LTO) flags
> main['LTO_CCFLAGS'] = []
> main['LTO_LDFLAGS'] = []
>
508a515,532
>
> # LTO support is only really working properly from 4.6 and beyond
> if compareVersions(gcc_version, '4.6') >= 0:
> # Add the appropriate Link-Time Optimization (LTO) flags
> # unless LTO is explicitly turned off. Note that these flags
> # are only used by the fast target.
> if not GetOption('no_lto'):
> # Pass the LTO flag when compiling to produce GIMPLE
> # output, we merely create the flags here and only append
> # them later/
> main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
>
> # Use the same amount of jobs for LTO as we are running
> # scons with, we hardcode the use of the linker plugin
> # which requires either gold or GNU ld >= 2.21
> main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs'),
> '-fuse-linker-plugin']
>