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

Unified Diff: site_scons/site_tools/naclsdk.py

Issue 639113003: Add nacl-clang testing to SCons (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: ncbray comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pnacl/support/clang_direct/crtbegin.c ('k') | src/trusted/validator/nacl.scons » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: site_scons/site_tools/naclsdk.py
diff --git a/site_scons/site_tools/naclsdk.py b/site_scons/site_tools/naclsdk.py
index 5347a8750e4be8a89b6ddf5cdef5eb63680d6c2f..ab65f2f09c6b785b3d3ec13da593ac330bc20761 100755
--- a/site_scons/site_tools/naclsdk.py
+++ b/site_scons/site_tools/naclsdk.py
@@ -99,6 +99,15 @@ def _SetEnvForNativeSdk(env, sdk_path):
raise Exception("Cannot find a toolchain for %s in %s" %
(env['TARGET_FULLARCH'], sdk_path))
+ cc = 'clang' if env.Bit('nacl_clang') else 'gcc'
+ cxx = 'clang++' if env.Bit('nacl_clang') else 'g++'
+ # Eventually nacl-clang will default to -no-integrated-as but for now we have
+ # to use the integrated as for compilation because of
+ # https://code.google.com/p/nativeclient/issues/detail?id=3966
+ # However clang's as' support of some of the nacl syntax is incomplete, so for
+ # now use binutils as for our asm files.
+ as_flags = '-no-integrated-as' if env.Bit('nacl_clang') else []
+
env.Replace(# Replace header and lib paths.
# where to put nacl extra sdk headers
# TODO(robertm): switch to using the mechanism that
@@ -107,14 +116,14 @@ def _SetEnvForNativeSdk(env, sdk_path):
# where to find/put nacl generic extra sdk libraries
NACL_SDK_LIB='%s/%s' % (sdk_path, libdir),
# Replace the normal unix tools with the NaCl ones.
- CC=os.path.join(bin_path, '%s-gcc' % tool_prefix),
- CXX=os.path.join(bin_path, '%s-g++' % tool_prefix),
+ CC=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)),
+ CXX=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)),
AR=os.path.join(bin_path, '%s-ar' % tool_prefix),
AS=os.path.join(bin_path, '%s-as' % tool_prefix),
- ASPP=os.path.join(bin_path, '%s-gcc' % tool_prefix),
+ ASPP=os.path.join(bin_path, '%s-%s' % (tool_prefix, cc)),
GDB=os.path.join(bin_path, '%s-gdb' % tool_prefix),
# NOTE: use g++ for linking so we can handle C AND C++.
- LINK=os.path.join(bin_path, '%s-g++' % tool_prefix),
+ LINK=os.path.join(bin_path, '%s-%s' % (tool_prefix, cxx)),
# Grrr... and sometimes we really need ld.
LD=os.path.join(bin_path, '%s-ld' % tool_prefix) + ld_mode_flag,
RANLIB=os.path.join(bin_path, '%s-ranlib' % tool_prefix),
@@ -139,7 +148,7 @@ def _SetEnvForNativeSdk(env, sdk_path):
'-pedantic',
'-D__linux__',
],
- ASFLAGS=[],
+ ASFLAGS=as_flags,
)
# NaClSdk environment seems to be inherited from the host environment.
@@ -665,22 +674,22 @@ def generate(env):
# if bitcode=1 use pnacl toolchain
if env.Bit('bitcode'):
_SetEnvForPnacl(env, root)
+ elif env.Bit('built_elsewhere'):
+ _StubOutEnvToolsForBuiltElsewhere(env)
+ else:
+ _SetEnvForNativeSdk(env, root)
+ if (env.Bit('bitcode') or env.Bit('nacl_clang')) and env.Bit('target_x86'):
# Get GDB from the nacl-gcc toolchain even when using PNaCl.
# TODO(mseaborn): We really want the nacl-gdb binary to be in a
# separate tarball from the nacl-gcc toolchain, then this step
# will not be necessary.
# See http://code.google.com/p/nativeclient/issues/detail?id=2773
- if env.Bit('target_x86'):
- temp_env = env.Clone()
- temp_env.ClearBits('bitcode')
- temp_root = temp_env.GetToolchainDir()
- _SetEnvForNativeSdk(temp_env, temp_root)
- env.Replace(GDB=temp_env['GDB'])
- elif env.Bit('built_elsewhere'):
- _StubOutEnvToolsForBuiltElsewhere(env)
- else:
- _SetEnvForNativeSdk(env, root)
+ temp_env = env.Clone()
+ temp_env.ClearBits('bitcode', 'nacl_clang')
+ temp_root = temp_env.GetToolchainDir()
+ _SetEnvForNativeSdk(temp_env, temp_root)
+ env.Replace(GDB=temp_env['GDB'])
env.Prepend(LIBPATH='${NACL_SDK_LIB}')
« no previous file with comments | « pnacl/support/clang_direct/crtbegin.c ('k') | src/trusted/validator/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698