Chromium Code Reviews| Index: SConstruct |
| diff --git a/SConstruct b/SConstruct |
| index 1661234a75e88514aebf1029af1510114bbf969b..070cc08ed3a53a35e7955e6db6f5e55817a071f9 100755 |
| --- a/SConstruct |
| +++ b/SConstruct |
| @@ -261,6 +261,9 @@ def SetUpArgumentBits(env): |
| BitFromArgument(env, 'bitcode', default=False, |
| desc='We are building bitcode') |
| + BitFromArgument(env, 'nacl_clang', default=False, |
| + desc='Use native nacl-clang compiler') |
| + |
| BitFromArgument(env, 'translate_fast', default=False, |
| desc='When using pnacl TC (bitcode=1) use accelerated translation step') |
| @@ -1240,7 +1243,8 @@ def GetToolchainDir(env, platform_build_dir=None, toolchain_name=None, |
| if toolchain_name is None: |
| # Fill in default arguments based on environment. |
| if is_pnacl is None: |
| - is_pnacl = env.Bit('bitcode') |
| + # For the purposes of finding the toolchain dir, nacl_clang is PNaCl. |
| + is_pnacl = env.Bit('bitcode') or env.Bit('nacl_clang') |
| if lib_name is None: |
| if is_pnacl or not env.Bit('nacl_glibc'): |
| lib_name = 'newlib' |
| @@ -2908,6 +2912,8 @@ pre_base_env.Append( |
| # independent binaries |
| # NOTE: this loads stuff from: site_scons/site_tools/naclsdk.py |
| nacl_env = MakeArchSpecificEnv() |
| +# See comment below about libc++ and libpthread in NONIRT_LIBS. |
| +needs_pthread = nacl_env.Bit('bitcode') or nacl_env.Bit('nacl_clang') |
| nacl_env = nacl_env.Clone( |
| tools = ['naclsdk'], |
| NACL_BUILD_FAMILY = 'UNTRUSTED', |
| @@ -2961,10 +2967,16 @@ nacl_env = nacl_env.Clone( |
| # These are settings for in-tree, non-browser tests to use. |
| # They use libraries that circumvent the IRT-based implementations |
| # in the public libraries. |
| - # Note that pthread_private is part of NONIRT_LIBS for PNaCl because |
| - # libc++ depends on it. |
| + # Note that pthread_private is part of NONIRT_LIBS for clang because |
| + # libc++ depends on libpthread. However we can't just add |
| + # libpthread_private to the link line because those libs get added before |
| + # the standard libs, so the references that come from libc++ itself will |
| + # stil get satisfied from libpthread instead of libpthread_private (and |
|
jvoung (off chromium)
2014/10/09 17:35:01
"still get"
Derek Schuff
2014/10/09 18:40:40
Done.
|
| + # that code will crash because it requires the IRT). So put libc++ on the |
| + # user link line before libpthread_private to ensure that its references |
|
jvoung (off chromium)
2014/10/09 17:35:01
I guess this is the actual hack that was in pnacl-
Derek Schuff
2014/10/09 18:40:39
Yeah the idea was to allow this to remove the hack
|
| + # to libpthread also get satisfied by libpthread_private. |
| NONIRT_LIBS = (['nacl_sys_private'] + |
| - (['pthread_private'] if nacl_env.Bit('bitcode') else [])), |
| + (['c++','pthread_private'] if needs_pthread else [])), |
| PTHREAD_LIBS = ['pthread_private'], |
| DYNCODE_LIBS = ['nacl_dyncode_private'], |
| EXCEPTION_LIBS = ['nacl_exception_private'], |
| @@ -3162,6 +3174,11 @@ if nacl_env.Bit('bitcode'): |
| # http://code.google.com/p/nativeclient/issues/detail?id=2861 |
| nacl_env.Append(CCFLAGS=['-Wno-unused-private-field']) |
| +if nacl_env.Bit('nacl_clang'): |
| + nacl_env.Append(CCFLAGS=['-Wno-format-security']) |
|
jvoung (off chromium)
2014/10/09 17:35:01
Why is Wno-format-security needed for nacl_clang?
Derek Schuff
2014/10/09 18:40:39
Hm, i had it in there during bootstrapping for som
|
| + # third_party/valgrind/nacl_valgrind.h uses asm instead of __asm__ |
| + nacl_env.Append(CCFLAGS=['-Wno-language-extension-token']) |
| + |
| # We use a special environment for building the IRT image because it must |
| # always use the newlib toolchain, regardless of --nacl_glibc. We clone |
| # it from nacl_env here, before too much other cruft has been added. |
| @@ -3190,6 +3207,7 @@ target_variant_map = [ |
| ('nacl_glibc', 'glibc'), |
| ('pnacl_generate_pexe', 'pexe'), |
| ('nonsfi_nacl', 'nonsfi'), |
| + ('nacl_clang', 'clang'), |
| ] |
| for variant_bit, variant_suffix in target_variant_map: |
| if nacl_env.Bit(variant_bit): |
| @@ -3659,6 +3677,11 @@ def AddImplicitLibs(env): |
| # TODO(mcgrathr): multilib nonsense defeats -B! figure out a better way. |
| if GetTargetPlatform() == 'x86-32': |
| implicit_libs.append(os.path.join('32', 'crt1.o')) |
| + # libc++ depends on libpthread, and because PPAPI applications always need |
| + # threads anyway, nacl-clang just includes -lpthread unconditionally. |
| + if ((env.Bit('nacl_clang') or env.Bit('bitcode')) and |
|
jvoung (off chromium)
2014/10/09 17:35:01
Can use "needs_pthread" here too
Derek Schuff
2014/10/09 18:40:39
Done, and renamed.
|
| + env['NACL_BUILD_FAMILY'] != 'UNTRUSTED_IRT'): |
| + implicit_libs += ['libpthread.a'] |
| if implicit_libs != []: |
| env['IMPLICIT_LIBS'] = [env.File(os.path.join('${LIB_DIR}', file)) |