Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: SConstruct

Issue 639113003: Add nacl-clang testing to SCons (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: review 2 Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pnacl/support/clang_direct/crtbegin.c » ('j') | tests/fixedfeaturecpu/nacl.scons » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #! -*- python -*- 1 #! -*- python -*-
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import atexit 6 import atexit
7 import json 7 import json
8 import os 8 import os
9 import platform 9 import platform
10 import re 10 import re
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 # NOTE Command-line arguments are a SCons-ism that is separate from 254 # NOTE Command-line arguments are a SCons-ism that is separate from
255 # command-line options. Options are prefixed by "-" or "--" whereas arguments 255 # command-line options. Options are prefixed by "-" or "--" whereas arguments
256 # are not. The function SetBitFromOption can be used for options. 256 # are not. The function SetBitFromOption can be used for options.
257 # NOTE This function must be called before the bits are used 257 # NOTE This function must be called before the bits are used
258 # NOTE This function must be called after all modifications of ARGUMENTS have 258 # NOTE This function must be called after all modifications of ARGUMENTS have
259 # been performed. See: ExpandArguments 259 # been performed. See: ExpandArguments
260 def SetUpArgumentBits(env): 260 def SetUpArgumentBits(env):
261 BitFromArgument(env, 'bitcode', default=False, 261 BitFromArgument(env, 'bitcode', default=False,
262 desc='We are building bitcode') 262 desc='We are building bitcode')
263 263
264 BitFromArgument(env, 'nacl_clang', default=False,
265 desc='Use native nacl-clang compiler')
266
264 BitFromArgument(env, 'translate_fast', default=False, 267 BitFromArgument(env, 'translate_fast', default=False,
265 desc='When using pnacl TC (bitcode=1) use accelerated translation step') 268 desc='When using pnacl TC (bitcode=1) use accelerated translation step')
266 269
267 BitFromArgument(env, 'built_elsewhere', default=False, 270 BitFromArgument(env, 'built_elsewhere', default=False,
268 desc='The programs have already been built by another system') 271 desc='The programs have already been built by another system')
269 272
270 BitFromArgument(env, 'skip_trusted_tests', default=False, 273 BitFromArgument(env, 'skip_trusted_tests', default=False,
271 desc='Only run untrusted tests - useful for translator testing' 274 desc='Only run untrusted tests - useful for translator testing'
272 ' (also skips tests of the IRT itself') 275 ' (also skips tests of the IRT itself')
273 276
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 1236
1234 1237
1235 def GetToolchainDir(env, platform_build_dir=None, toolchain_name=None, 1238 def GetToolchainDir(env, platform_build_dir=None, toolchain_name=None,
1236 target_arch=None, is_pnacl=None, lib_name=None): 1239 target_arch=None, is_pnacl=None, lib_name=None):
1237 if platform_build_dir is None: 1240 if platform_build_dir is None:
1238 platform_build_dir = env.GetPlatformBuildTargetDir() 1241 platform_build_dir = env.GetPlatformBuildTargetDir()
1239 1242
1240 if toolchain_name is None: 1243 if toolchain_name is None:
1241 # Fill in default arguments based on environment. 1244 # Fill in default arguments based on environment.
1242 if is_pnacl is None: 1245 if is_pnacl is None:
1243 is_pnacl = env.Bit('bitcode') 1246 # For the purposes of finding the toolchain dir, nacl_clang is PNaCl.
1247 is_pnacl = env.Bit('bitcode') or env.Bit('nacl_clang')
1244 if lib_name is None: 1248 if lib_name is None:
1245 if is_pnacl or not env.Bit('nacl_glibc'): 1249 if is_pnacl or not env.Bit('nacl_glibc'):
1246 lib_name = 'newlib' 1250 lib_name = 'newlib'
1247 else: 1251 else:
1248 lib_name = 'glibc' 1252 lib_name = 'glibc'
1249 1253
1250 if target_arch is None: 1254 if target_arch is None:
1251 target_arch = pynacl.platform.GetArch(GetTargetPlatform()) 1255 target_arch = pynacl.platform.GetArch(GetTargetPlatform())
1252 1256
1253 if is_pnacl: 1257 if is_pnacl:
(...skipping 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after
2901 # Do this before the site_scons/site_tools/naclsdk.py stuff to pass it along. 2905 # Do this before the site_scons/site_tools/naclsdk.py stuff to pass it along.
2902 pre_base_env.Append( 2906 pre_base_env.Append(
2903 PNACL_BCLDFLAGS = ARGUMENTS.get('pnacl_bcldflags', '').split(':')) 2907 PNACL_BCLDFLAGS = ARGUMENTS.get('pnacl_bcldflags', '').split(':'))
2904 2908
2905 2909
2906 # The nacl_env is used to build native_client modules 2910 # The nacl_env is used to build native_client modules
2907 # using a special tool chain which produces platform 2911 # using a special tool chain which produces platform
2908 # independent binaries 2912 # independent binaries
2909 # NOTE: this loads stuff from: site_scons/site_tools/naclsdk.py 2913 # NOTE: this loads stuff from: site_scons/site_tools/naclsdk.py
2910 nacl_env = MakeArchSpecificEnv() 2914 nacl_env = MakeArchSpecificEnv()
2915 # See comment below about libc++ and libpthread in NONIRT_LIBS.
2916 using_nacl_libcxx = nacl_env.Bit('nacl_clang')
Roland McGrath 2014/10/09 22:01:37 Drop this variable. All it seems to be doing is m
Derek Schuff 2014/10/09 22:22:00 In the original version of this CL, this variable
2911 nacl_env = nacl_env.Clone( 2917 nacl_env = nacl_env.Clone(
2912 tools = ['naclsdk'], 2918 tools = ['naclsdk'],
2913 NACL_BUILD_FAMILY = 'UNTRUSTED', 2919 NACL_BUILD_FAMILY = 'UNTRUSTED',
2914 BUILD_TYPE = 'nacl', 2920 BUILD_TYPE = 'nacl',
2915 BUILD_TYPE_DESCRIPTION = 'NaCl module build', 2921 BUILD_TYPE_DESCRIPTION = 'NaCl module build',
2916 2922
2917 ARFLAGS = 'rc', 2923 ARFLAGS = 'rc',
2918 2924
2919 # ${SOURCE_ROOT} for #include <ppapi/...> 2925 # ${SOURCE_ROOT} for #include <ppapi/...>
2920 CPPPATH = [ 2926 CPPPATH = [
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 '__env__, RDirs, TARGET, SOURCE)} $)', 2960 '__env__, RDirs, TARGET, SOURCE)} $)',
2955 RPATHLINKPREFIX = '-Wl,-rpath-link,', 2961 RPATHLINKPREFIX = '-Wl,-rpath-link,',
2956 RPATHLINKSUFFIX = '', 2962 RPATHLINKSUFFIX = '',
2957 2963
2958 LIBS = [], 2964 LIBS = [],
2959 LINKFLAGS = ['${RPATH_LINK_FLAGS}'], 2965 LINKFLAGS = ['${RPATH_LINK_FLAGS}'],
2960 2966
2961 # These are settings for in-tree, non-browser tests to use. 2967 # These are settings for in-tree, non-browser tests to use.
2962 # They use libraries that circumvent the IRT-based implementations 2968 # They use libraries that circumvent the IRT-based implementations
2963 # in the public libraries. 2969 # in the public libraries.
2964 # Note that pthread_private is part of NONIRT_LIBS for PNaCl because 2970 # Note that pthread_private is part of NONIRT_LIBS for clang because
2965 # libc++ depends on it. 2971 # libc++ depends on libpthread. However we can't just add
2972 # libpthread_private to the link line because those libs get added before
2973 # the standard libs, so the references that come from libc++ itself will
2974 # still get satisfied from libpthread instead of libpthread_private (and
2975 # that code will crash because it requires the IRT). So put libc++ on the
2976 # user link line before libpthread_private to ensure that its references
2977 # to libpthread also get satisfied by libpthread_private.
2978 # TODO(dschuff): Also remove the hack in pnacl-ld and use this for pnacl.
2966 NONIRT_LIBS = (['nacl_sys_private'] + 2979 NONIRT_LIBS = (['nacl_sys_private'] +
2967 (['pthread_private'] if nacl_env.Bit('bitcode') else [])), 2980 (['c++','pthread_private'] if using_nacl_libcxx else [])),
2968 PTHREAD_LIBS = ['pthread_private'], 2981 PTHREAD_LIBS = ['pthread_private'],
2969 DYNCODE_LIBS = ['nacl_dyncode_private'], 2982 DYNCODE_LIBS = ['nacl_dyncode_private'],
2970 EXCEPTION_LIBS = ['nacl_exception_private'], 2983 EXCEPTION_LIBS = ['nacl_exception_private'],
2971 LIST_MAPPINGS_LIBS = ['nacl_list_mappings_private'], 2984 LIST_MAPPINGS_LIBS = ['nacl_list_mappings_private'],
2972 RANDOM_LIBS = ['nacl_random_private'], 2985 RANDOM_LIBS = ['nacl_random_private'],
2973 ) 2986 )
2974 2987
2975 def UsesAbiNote(env): 2988 def UsesAbiNote(env):
2976 """Return True if using a new-style GCC with .note.NaCl.ABI.* notes. 2989 """Return True if using a new-style GCC with .note.NaCl.ABI.* notes.
2977 This means there will always be an RODATA segment, even if just for the note.""" 2990 This means there will always be an RODATA segment, even if just for the note."""
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 3168
3156 # With pnacl's clang base/ code uses the "override" keyword. 3169 # With pnacl's clang base/ code uses the "override" keyword.
3157 nacl_env.Append(CXXFLAGS=['-Wno-c++11-extensions']) 3170 nacl_env.Append(CXXFLAGS=['-Wno-c++11-extensions'])
3158 # Allow extraneous semicolons. (Until these are removed.) 3171 # Allow extraneous semicolons. (Until these are removed.)
3159 # http://code.google.com/p/nativeclient/issues/detail?id=2861 3172 # http://code.google.com/p/nativeclient/issues/detail?id=2861
3160 nacl_env.Append(CCFLAGS=['-Wno-extra-semi']) 3173 nacl_env.Append(CCFLAGS=['-Wno-extra-semi'])
3161 # Allow unused private fields. (Until these are removed.) 3174 # Allow unused private fields. (Until these are removed.)
3162 # http://code.google.com/p/nativeclient/issues/detail?id=2861 3175 # http://code.google.com/p/nativeclient/issues/detail?id=2861
3163 nacl_env.Append(CCFLAGS=['-Wno-unused-private-field']) 3176 nacl_env.Append(CCFLAGS=['-Wno-unused-private-field'])
3164 3177
3178 if nacl_env.Bit('nacl_clang'):
3179 # third_party/valgrind/nacl_valgrind.h uses asm instead of __asm__
Roland McGrath 2014/10/09 22:01:37 File a bug and a TODO for just fixing that header.
Derek Schuff 2014/10/09 22:22:00 Done.
3180 nacl_env.Append(CCFLAGS=['-Wno-language-extension-token'])
3181
3165 # We use a special environment for building the IRT image because it must 3182 # We use a special environment for building the IRT image because it must
3166 # always use the newlib toolchain, regardless of --nacl_glibc. We clone 3183 # always use the newlib toolchain, regardless of --nacl_glibc. We clone
3167 # it from nacl_env here, before too much other cruft has been added. 3184 # it from nacl_env here, before too much other cruft has been added.
3168 # We do some more magic below to instantiate it the way we need it. 3185 # We do some more magic below to instantiate it the way we need it.
3169 nacl_irt_env = nacl_env.Clone( 3186 nacl_irt_env = nacl_env.Clone(
3170 BUILD_TYPE = 'nacl_irt', 3187 BUILD_TYPE = 'nacl_irt',
3171 BUILD_TYPE_DESCRIPTION = 'NaCl IRT build', 3188 BUILD_TYPE_DESCRIPTION = 'NaCl IRT build',
3172 NACL_BUILD_FAMILY = 'UNTRUSTED_IRT', 3189 NACL_BUILD_FAMILY = 'UNTRUSTED_IRT',
3173 ) 3190 )
3174 3191
3175 # Provide access to the IRT build environment from the default environment 3192 # Provide access to the IRT build environment from the default environment
3176 # which is needed when compiling custom IRT for testing purposes. 3193 # which is needed when compiling custom IRT for testing purposes.
3177 nacl_env['NACL_IRT_ENV'] = nacl_irt_env 3194 nacl_env['NACL_IRT_ENV'] = nacl_irt_env
3178 3195
3179 # Since we don't build src/untrusted/pthread/nacl.scons in 3196 # Since we don't build src/untrusted/pthread/nacl.scons in
3180 # nacl_irt_env, we must tell the IRT how to find the pthread.h header. 3197 # nacl_irt_env, we must tell the IRT how to find the pthread.h header.
3181 nacl_irt_env.Append(CPPPATH='${MAIN_DIR}/src/untrusted/pthread') 3198 nacl_irt_env.Append(CPPPATH='${MAIN_DIR}/src/untrusted/pthread')
3182 3199
3183 # Map certain flag bits to suffices on the build output. This needs to 3200 # Map certain flag bits to suffices on the build output. This needs to
3184 # happen pretty early, because it affects any concretized directory names. 3201 # happen pretty early, because it affects any concretized directory names.
3185 target_variant_map = [ 3202 target_variant_map = [
3186 ('bitcode', 'pnacl'), 3203 ('bitcode', 'pnacl'),
3187 ('translate_fast', 'fast'), 3204 ('translate_fast', 'fast'),
3188 ('nacl_pic', 'pic'), 3205 ('nacl_pic', 'pic'),
3189 ('use_sandboxed_translator', 'sbtc'), 3206 ('use_sandboxed_translator', 'sbtc'),
3190 ('nacl_glibc', 'glibc'), 3207 ('nacl_glibc', 'glibc'),
3191 ('pnacl_generate_pexe', 'pexe'), 3208 ('pnacl_generate_pexe', 'pexe'),
3192 ('nonsfi_nacl', 'nonsfi'), 3209 ('nonsfi_nacl', 'nonsfi'),
3210 ('nacl_clang', 'clang'),
3193 ] 3211 ]
3194 for variant_bit, variant_suffix in target_variant_map: 3212 for variant_bit, variant_suffix in target_variant_map:
3195 if nacl_env.Bit(variant_bit): 3213 if nacl_env.Bit(variant_bit):
3196 nacl_env['TARGET_VARIANT'] += '-' + variant_suffix 3214 nacl_env['TARGET_VARIANT'] += '-' + variant_suffix
3197 3215
3198 if nacl_env.Bit('bitcode'): 3216 if nacl_env.Bit('bitcode'):
3199 nacl_env['TARGET_VARIANT'] += '-clang' 3217 nacl_env['TARGET_VARIANT'] += '-clang'
3200 3218
3201 nacl_env.Replace(TESTRUNNER_LIBS=['testrunner']) 3219 nacl_env.Replace(TESTRUNNER_LIBS=['testrunner'])
3202 # TODO(mseaborn): Drop this once chrome side has inlined this. 3220 # TODO(mseaborn): Drop this once chrome side has inlined this.
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3652 if env.Bit('bitcode'): 3670 if env.Bit('bitcode'):
3653 implicit_libs += ['libnacl.a'] 3671 implicit_libs += ['libnacl.a']
3654 else: 3672 else:
3655 implicit_libs += ['crt1.o', 3673 implicit_libs += ['crt1.o',
3656 'libnacl.a', 3674 'libnacl.a',
3657 'crti.o', 3675 'crti.o',
3658 'crtn.o'] 3676 'crtn.o']
3659 # TODO(mcgrathr): multilib nonsense defeats -B! figure out a better way. 3677 # TODO(mcgrathr): multilib nonsense defeats -B! figure out a better way.
3660 if GetTargetPlatform() == 'x86-32': 3678 if GetTargetPlatform() == 'x86-32':
3661 implicit_libs.append(os.path.join('32', 'crt1.o')) 3679 implicit_libs.append(os.path.join('32', 'crt1.o'))
3680 # libc++ depends on libpthread, and because PPAPI applications always need
3681 # threads anyway, nacl-clang just includes -lpthread unconditionally.
3682 if using_nacl_libcxx and env['NACL_BUILD_FAMILY'] != 'UNTRUSTED_IRT':
3683 implicit_libs += ['libpthread.a']
3662 3684
3663 if implicit_libs != []: 3685 if implicit_libs != []:
3664 env['IMPLICIT_LIBS'] = [env.File(os.path.join('${LIB_DIR}', file)) 3686 env['IMPLICIT_LIBS'] = [env.File(os.path.join('${LIB_DIR}', file))
3665 for file in implicit_libs] 3687 for file in implicit_libs]
3666 # The -B<dir>/ flag is necessary to tell gcc to look for crt[1in].o there. 3688 # The -B<dir>/ flag is necessary to tell gcc to look for crt[1in].o there.
3667 env.Prepend(LINKFLAGS=['-B${LIB_DIR}/']) 3689 env.Prepend(LINKFLAGS=['-B${LIB_DIR}/'])
3668 3690
3669 AddImplicitLibs(nacl_env) 3691 AddImplicitLibs(nacl_env)
3670 AddImplicitLibs(nacl_irt_env) 3692 AddImplicitLibs(nacl_irt_env)
3671 3693
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
4030 nacl_env.ValidateSdk() 4052 nacl_env.ValidateSdk()
4031 4053
4032 if BROKEN_TEST_COUNT > 0: 4054 if BROKEN_TEST_COUNT > 0:
4033 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 4055 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
4034 if GetOption('brief_comstr'): 4056 if GetOption('brief_comstr'):
4035 msg += " Add --verbose to the command line for more information." 4057 msg += " Add --verbose to the command line for more information."
4036 print msg 4058 print msg
4037 4059
4038 # separate warnings from actual build output 4060 # separate warnings from actual build output
4039 Banner('B U I L D - O U T P U T:') 4061 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | pnacl/support/clang_direct/crtbegin.c » ('j') | tests/fixedfeaturecpu/nacl.scons » ('J')

Powered by Google App Engine
This is Rietveld 408576698