SConstruct (12061:0225580779db) SConstruct (12063:06cd2c297b04)
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 169 unchanged lines hidden (view full) ---

178 action='store_true',
179 help="Build with support for C++-based configuration")
180AddLocalOption('--default', dest='default', type='string', action='store',
181 help='Override which build_opts file to use for defaults')
182AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
183 help='Disable style checking hooks')
184AddLocalOption('--no-lto', dest='no_lto', action='store_true',
185 help='Disable Link-Time Optimization for fast')
1# -*- mode:python -*-
2
3# Copyright (c) 2013, 2015, 2016 ARM Limited
4# All rights reserved.
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 169 unchanged lines hidden (view full) ---

178 action='store_true',
179 help="Build with support for C++-based configuration")
180AddLocalOption('--default', dest='default', type='string', action='store',
181 help='Override which build_opts file to use for defaults')
182AddLocalOption('--ignore-style', dest='ignore_style', action='store_true',
183 help='Disable style checking hooks')
184AddLocalOption('--no-lto', dest='no_lto', action='store_true',
185 help='Disable Link-Time Optimization for fast')
186AddLocalOption('--force-lto', dest='force_lto', action='store_true',
187 help='Use Link-Time Optimization instead of partial linking' +
188 ' when the compiler doesn\'t support using them together.')
186AddLocalOption('--update-ref', dest='update_ref', action='store_true',
187 help='Update test reference outputs')
188AddLocalOption('--verbose', dest='verbose', action='store_true',
189 help='Print full tool command lines')
190AddLocalOption('--without-python', dest='without_python',
191 action='store_true',
192 help='Build without Python configuration support')
193AddLocalOption('--without-tcmalloc', dest='without_tcmalloc',
194 action='store_true',
195 help='Disable linking against tcmalloc')
196AddLocalOption('--with-ubsan', dest='with_ubsan', action='store_true',
197 help='Build with Undefined Behavior Sanitizer if available')
198AddLocalOption('--with-asan', dest='with_asan', action='store_true',
199 help='Build with Address Sanitizer if available')
200
189AddLocalOption('--update-ref', dest='update_ref', action='store_true',
190 help='Update test reference outputs')
191AddLocalOption('--verbose', dest='verbose', action='store_true',
192 help='Print full tool command lines')
193AddLocalOption('--without-python', dest='without_python',
194 action='store_true',
195 help='Build without Python configuration support')
196AddLocalOption('--without-tcmalloc', dest='without_tcmalloc',
197 action='store_true',
198 help='Disable linking against tcmalloc')
199AddLocalOption('--with-ubsan', dest='with_ubsan', action='store_true',
200 help='Build with Undefined Behavior Sanitizer if available')
201AddLocalOption('--with-asan', dest='with_asan', action='store_true',
202 help='Build with Address Sanitizer if available')
203
204if GetOption('no_lto') and GetOption('force_lto'):
205 print '--no-lto and --force-lto are mutually exclusive'
206 Exit(1)
207
201termcap = get_termcap(GetOption('use_colors'))
202
203########################################################################
204#
205# Set up the main build environment.
206#
207########################################################################
208

--- 505 unchanged lines hidden (view full) ---

714 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
715 if compareVersions(gcc_version, "4.8") < 0:
716 print 'Error: gcc version 4.8 or newer required.'
717 print ' Installed version:', gcc_version
718 Exit(1)
719
720 main['GCC_VERSION'] = gcc_version
721
208termcap = get_termcap(GetOption('use_colors'))
209
210########################################################################
211#
212# Set up the main build environment.
213#
214########################################################################
215

--- 505 unchanged lines hidden (view full) ---

721 gcc_version = readCommand([main['CXX'], '-dumpversion'], exception=False)
722 if compareVersions(gcc_version, "4.8") < 0:
723 print 'Error: gcc version 4.8 or newer required.'
724 print ' Installed version:', gcc_version
725 Exit(1)
726
727 main['GCC_VERSION'] = gcc_version
728
729 if compareVersions(gcc_version, '4.9') >= 0:
730 # Incremental linking with LTO is currently broken in gcc versions
731 # 4.9 and above. A version where everything works completely hasn't
732 # yet been identified.
733 #
734 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67548
735 main['BROKEN_INCREMENTAL_LTO'] = True
736 if compareVersions(gcc_version, '6.0') >= 0:
737 # gcc versions 6.0 and greater accept an -flinker-output flag which
738 # selects what type of output the linker should generate. This is
739 # necessary for incremental lto to work, but is also broken in
740 # current versions of gcc. It may not be necessary in future
741 # versions. We add it here since it might be, and as a reminder that
742 # it exists. It's excluded if lto is being forced.
743 #
744 # https://gcc.gnu.org/gcc-6/changes.html
745 # https://gcc.gnu.org/ml/gcc-patches/2015-11/msg03161.html
746 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69866
747 if not GetOption('force_lto'):
748 main.Append(PSHLINKFLAGS='-flinker-output=rel')
749 main.Append(PLINKFLAGS='-flinker-output=rel')
750
722 # gcc from version 4.8 and above generates "rep; ret" instructions
723 # to avoid performance penalties on certain AMD chips. Older
724 # assemblers detect this as an error, "Error: expecting string
725 # instruction after `rep'"
726 as_version_raw = readCommand([main['AS'], '-v', '/dev/null',
727 '-o', '/dev/null'],
728 exception=False).split()
729

--- 14 unchanged lines hidden (view full) ---

744 # Undefined Benahvior Sanitizer and this version of gcc does not
745 # support it.
746 if GetOption('with_ubsan') and \
747 compareVersions(gcc_version, '4.9') < 0:
748 print termcap.Yellow + termcap.Bold + \
749 'Warning: UBSan is only supported using gcc 4.9 and later.' + \
750 termcap.Normal
751
751 # gcc from version 4.8 and above generates "rep; ret" instructions
752 # to avoid performance penalties on certain AMD chips. Older
753 # assemblers detect this as an error, "Error: expecting string
754 # instruction after `rep'"
755 as_version_raw = readCommand([main['AS'], '-v', '/dev/null',
756 '-o', '/dev/null'],
757 exception=False).split()
758

--- 14 unchanged lines hidden (view full) ---

773 # Undefined Benahvior Sanitizer and this version of gcc does not
774 # support it.
775 if GetOption('with_ubsan') and \
776 compareVersions(gcc_version, '4.9') < 0:
777 print termcap.Yellow + termcap.Bold + \
778 'Warning: UBSan is only supported using gcc 4.9 and later.' + \
779 termcap.Normal
780
781 disable_lto = GetOption('no_lto')
782 if not disable_lto and main.get('BROKEN_INCREMENTAL_LTO', False) and \
783 not GetOption('force_lto'):
784 print termcap.Yellow + termcap.Bold + \
785 'Warning: Your compiler doesn\'t support incremental linking' + \
786 ' and lto at the same time, so lto is being disabled. To force' + \
787 ' lto on anyway, use the --force-lto option. That will disable' + \
788 ' partial linking.' + \
789 termcap.Normal
790 disable_lto = True
791
752 # Add the appropriate Link-Time Optimization (LTO) flags
753 # unless LTO is explicitly turned off. Note that these flags
754 # are only used by the fast target.
792 # Add the appropriate Link-Time Optimization (LTO) flags
793 # unless LTO is explicitly turned off. Note that these flags
794 # are only used by the fast target.
755 if not GetOption('no_lto'):
795 if not disable_lto:
756 # Pass the LTO flag when compiling to produce GIMPLE
757 # output, we merely create the flags here and only append
758 # them later
759 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
760
761 # Use the same amount of jobs for LTO as we are running
762 # scons with
763 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]

--- 782 unchanged lines hidden ---
796 # Pass the LTO flag when compiling to produce GIMPLE
797 # output, we merely create the flags here and only append
798 # them later
799 main['LTO_CCFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]
800
801 # Use the same amount of jobs for LTO as we are running
802 # scons with
803 main['LTO_LDFLAGS'] = ['-flto=%d' % GetOption('num_jobs')]

--- 782 unchanged lines hidden ---