diff options
author | sbc <sbc@chromium.org> | 2015-02-17 14:22:37 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-17 22:23:34 +0000 |
commit | edbe84670e56798b194943dd567a9c38e1d41a6b (patch) | |
tree | 0afdc8632ad8736cfd5042c50509f849d7f53199 /native_client_sdk | |
parent | 89a8dc89370d682d3d5dc8d7dda94b19b750b7a2 (diff) | |
download | chromium_src-edbe84670e56798b194943dd567a9c38e1d41a6b.zip chromium_src-edbe84670e56798b194943dd567a9c38e1d41a6b.tar.gz chromium_src-edbe84670e56798b194943dd567a9c38e1d41a6b.tar.bz2 |
[NaCL SDK] Add initial support for nacl-clang
This adds 'clang-newlib' as new possible value for
$TOOLCHAIN and enables building of most examples
and libraries with the new toolchain.
Initially adding without ARM support. ARM support
will follow shortly.
Also, update buildbot_common.py to output shorter
filenames (making output easier to read).
BUG=454962
Review URL: https://codereview.chromium.org/924253002
Cr-Commit-Position: refs/heads/master@{#316672}
Diffstat (limited to 'native_client_sdk')
20 files changed, 168 insertions, 57 deletions
diff --git a/native_client_sdk/src/BUILDING.rst b/native_client_sdk/src/BUILDING.rst index a6d4cb4..973a2e9 100644 --- a/native_client_sdk/src/BUILDING.rst +++ b/native_client_sdk/src/BUILDING.rst @@ -84,8 +84,8 @@ You can build a specific toolchain/configuration combination:: make TOOLCHAIN=newlib CONFIG=Debug -j8 -The valid toolchains are: `newlib`, `glibc`, `pnacl` and `bionic`. -The valid configurations are: `Debug` and `Release`. +The valid toolchains are: `newlib`, `glibc`, `clang-newlib`, `pnacl` and +`bionic`. The valid configurations are: `Debug` and `Release`. To run the example:: diff --git a/native_client_sdk/src/build_tools/build_projects.py b/native_client_sdk/src/build_tools/build_projects.py index b25d7b7..bd49ccc 100755 --- a/native_client_sdk/src/build_tools/build_projects.py +++ b/native_client_sdk/src/build_tools/build_projects.py @@ -32,6 +32,7 @@ LIB_DICT = { VALID_TOOLCHAINS = [ 'bionic', 'newlib', + 'clang-newlib', 'glibc', 'pnacl', 'win', @@ -99,6 +100,7 @@ def ValidateToolchains(toolchains): buildbot_common.ErrorExit('Invalid toolchain(s): %s' % ( ', '.join(invalid_toolchains))) + def GetDeps(projects): out = {} @@ -298,7 +300,7 @@ def main(args): # be the first toolchain in this list that is available in the example. # e.g. If an example supports newlib and glibc, then the default will be # newlib. - options.toolchain = ['pnacl', 'newlib', 'glibc', 'host'] + options.toolchain = ['pnacl', 'newlib', 'glibc', 'host', 'clang-newlib'] if options.experimental or options.bionic: options.toolchain.append('bionic') diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py index 1bc4ebf..1711242 100755 --- a/native_client_sdk/src/build_tools/build_sdk.py +++ b/native_client_sdk/src/build_tools/build_sdk.py @@ -75,9 +75,9 @@ TOOLCHAIN_PACKAGE_MAP = { def GetToolchainNaClInclude(tcname, tcpath, arch): if arch == 'x86': - if tcname == 'pnacl': - return os.path.join(tcpath, 'le32-nacl', 'include') return os.path.join(tcpath, 'x86_64-nacl', 'include') + elif arch == 'pnacl': + return os.path.join(tcpath, 'le32-nacl', 'include') elif arch == 'arm': return os.path.join(tcpath, 'arm-nacl', 'include') else: @@ -85,7 +85,7 @@ def GetToolchainNaClInclude(tcname, tcpath, arch): def GetConfigDir(arch): - if arch == 'x64' and getos.GetPlatform() == 'win': + if arch.endswith('x64') and getos.GetPlatform() == 'win': return 'Release_x64' else: return 'Release' @@ -106,8 +106,13 @@ def GetGypBuiltLib(tcname, arch): lib_suffix = '' if tcname == 'pnacl': - tcname = 'pnacl_newlib' - arch = 'x64' + print arch + if arch is None: + arch = 'x64' + tcname = 'pnacl_newlib' + else: + arch = 'clang-' + arch + tcname = 'newlib' return os.path.join(GetNinjaOutDir(arch), 'gen', @@ -116,14 +121,14 @@ def GetGypBuiltLib(tcname, arch): def GetToolchainNaClLib(tcname, tcpath, arch): - if tcname == 'pnacl': - return os.path.join(tcpath, 'le32-nacl', 'lib') - elif arch == 'ia32': + if arch == 'ia32': return os.path.join(tcpath, 'x86_64-nacl', 'lib32') elif arch == 'x64': return os.path.join(tcpath, 'x86_64-nacl', 'lib') elif arch == 'arm': return os.path.join(tcpath, 'arm-nacl', 'lib') + elif tcname == 'pnacl': + return os.path.join(tcpath, 'le32-nacl', 'lib') def GetToolchainDirName(tcname, arch): @@ -326,8 +331,8 @@ def InstallFiles(src_root, dest_root, file_list): def InstallNaClHeaders(tc_dst_inc, tc_name): """Copies NaCl headers to expected locations in the toolchain.""" - if tc_name == 'arm': - # arm toolchain header should be the same as the x86 newlib + if tc_name in ('arm', 'pnacl'): + # arm and pnacl toolchain headers should be the same as the newlib # ones tc_name = 'newlib' @@ -443,14 +448,13 @@ def GypNinjaInstall(pepperdir, toolchains): for tc in set(toolchains) & set(['newlib', 'glibc', 'pnacl']): if tc == 'pnacl': - xarches = (None,) + xarches = (None, 'ia32', 'x64') + elif tc == 'glibc': + xarches = ('ia32', 'x64') else: xarches = ('arm', 'ia32', 'x64') for xarch in xarches: - if tc == 'glibc' and xarch == 'arm': - continue - src_dir = GetGypBuiltLib(tc, xarch) dst_dir = GetOutputToolchainLib(pepperdir, tc, xarch) InstallFiles(src_dir, dst_dir, TOOLCHAIN_LIBS[tc]) @@ -481,9 +485,16 @@ def GypNinjaBuild_NaCl(rel_out_dir): out_dir_32 = MakeNinjaRelPath(rel_out_dir + '-ia32') out_dir_64 = MakeNinjaRelPath(rel_out_dir + '-x64') out_dir_arm = MakeNinjaRelPath(rel_out_dir + '-arm') + out_dir_clang_32 = MakeNinjaRelPath(rel_out_dir + '-clang-ia32') + out_dir_clang_64 = MakeNinjaRelPath(rel_out_dir + '-clang-x64') + GypNinjaBuild('ia32', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_32) - GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm) GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_64) + GypNinjaBuild('ia32', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', + out_dir_clang_32, gyp_defines=['use_nacl_clang=1']) + GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', + out_dir_clang_64, gyp_defines=['use_nacl_clang=1']) + GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm) GypNinjaBuild('x64', gyp_py, all_gyp, 'ncval_new', out_dir_64) @@ -500,12 +511,13 @@ def GypNinjaBuild_Breakpad(rel_out_dir): GypNinjaBuild('x64', gyp_py, gyp_file, build_list, out_dir) -def GypNinjaBuild_PPAPI(arch, rel_out_dir): +def GypNinjaBuild_PPAPI(arch, rel_out_dir, gyp_defines=None): gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') out_dir = MakeNinjaRelPath(rel_out_dir) gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'native_client.gyp') - GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir) + GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir, + gyp_defines=gyp_defines) def GypNinjaBuild_Pnacl(rel_out_dir, target_arch): @@ -521,17 +533,20 @@ def GypNinjaBuild_Pnacl(rel_out_dir, target_arch): GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir) -def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): +def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, + out_dir, force_arm_gcc=True, gyp_defines=None): gyp_env = dict(os.environ) gyp_env['GYP_GENERATORS'] = 'ninja' - gyp_defines = ['nacl_allow_thin_archives=0'] + gyp_defines = gyp_defines or [] + gyp_defines.append('nacl_allow_thin_archives=0') if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) + if arch is not None: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': gyp_env['GYP_CROSSCOMPILE'] = '1' - gyp_defines += ['arm_float_abi=hard'] + gyp_defines.append('arm_float_abi=hard') if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') if getos.GetPlatform() == 'mac': @@ -545,7 +560,7 @@ def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): # Print relevant environment variables for key, value in gyp_env.iteritems(): if key.startswith('GYP') or key in ('CC',): - print '%s="%s"' % (key, value) + print ' %s="%s"' % (key, value) buildbot_common.Run( [sys.executable, gyp_py_script, gyp_file, '--depth=.'], @@ -581,6 +596,11 @@ def BuildStepBuildToolchains(pepperdir, toolchains, build, clean): GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm') if 'pnacl' in toolchains: + GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR + '-clang-ia32', + ['use_nacl_clang=1']) + GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR + '-clang-x64', + ['use_nacl_clang=1']) + # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default. for arch in ('ia32', 'arm'): # Fill in the latest native pnacl shim library from the chrome build. @@ -596,6 +616,7 @@ def BuildStepBuildToolchains(pepperdir, toolchains, build, clean): pnacldir = os.path.join(pepperdir, 'toolchain', platform + '_pnacl') bionicdir = os.path.join(pepperdir, 'toolchain', platform + '_arm_bionic') + if 'newlib' in toolchains: InstallNaClHeaders(GetToolchainNaClInclude('newlib', newlibdir, 'x86'), 'newlib') @@ -637,8 +658,10 @@ def BuildStepBuildToolchains(pepperdir, toolchains, build, clean): os.path.join(release_build_dir, 'libpnacl_irt_shim.a'), pnacl_translator_lib_dir) + InstallNaClHeaders(GetToolchainNaClInclude('pnacl', pnacldir, 'pnacl'), + 'pnacl') InstallNaClHeaders(GetToolchainNaClInclude('pnacl', pnacldir, 'x86'), - 'newlib') + 'pnacl') def MakeDirectoryOrClobber(pepperdir, dirname, clobber): @@ -732,6 +755,7 @@ def BuildStepVerifyFilelist(pepperdir): buildbot_common.BuildStep('Verify SDK Files') file_list_path = os.path.join(SCRIPT_DIR, 'sdk_files.list') try: + print 'SDK directory: %s' % pepperdir verify_filelist.Verify(file_list_path, pepperdir) print 'OK' except verify_filelist.ParseException, e: @@ -984,7 +1008,7 @@ def main(args): # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. - toolchains = ['pnacl', 'newlib', 'glibc', 'arm', 'host'] + toolchains = ['pnacl', 'newlib', 'glibc', 'arm', 'clang-newlib', 'host'] # Changes for experimental bionic builder if options.bionic: diff --git a/native_client_sdk/src/build_tools/buildbot_common.py b/native_client_sdk/src/build_tools/buildbot_common.py index d0186d5..37aace9 100644 --- a/native_client_sdk/src/build_tools/buildbot_common.py +++ b/native_client_sdk/src/build_tools/buildbot_common.py @@ -10,7 +10,7 @@ import os import subprocess import sys -from build_paths import SDK_SRC_DIR, NACL_DIR +from build_paths import SDK_SRC_DIR, NACL_DIR, SRC_DIR sys.path.append(os.path.join(SDK_SRC_DIR, 'tools')) import oshelpers @@ -156,19 +156,26 @@ def Run(args, cwd=None, env=None, shell=False): sys.stderr.flush() +def ShortFilename(filename): + drive = os.path.splitdrive(filename)[0] + if drive and drive != os.path.splitdrive(SRC_DIR)[0]: + return filename + return os.path.relpath(filename, SRC_DIR) + + def CopyDir(src, dst, excludes=('.svn', '*/.svn')): """Recursively copy a directory using.""" args = ['-r', src, dst] for exc in excludes: args.append('--exclude=' + exc) - Trace('cp -r %s %s' % (src, dst)) + Trace('cp -r %s %s' % (ShortFilename(src), ShortFilename(dst))) if os.path.abspath(src) == os.path.abspath(dst): ErrorExit('ERROR: Copying directory onto itself: ' + src) oshelpers.Copy(args) def CopyFile(src, dst): - Trace('cp %s %s' % (src, dst)) + Trace('cp %s %s' % (ShortFilename(src), ShortFilename(dst))) if os.path.abspath(src) == os.path.abspath(dst): ErrorExit('ERROR: Copying file onto itself: ' + src) args = [src, dst] @@ -177,25 +184,25 @@ def CopyFile(src, dst): def RemoveDir(dst): """Remove the provided path.""" - Trace('rm -fr ' + dst) + Trace('rm -fr ' + ShortFilename(dst)) oshelpers.Remove(['-fr', dst]) def MakeDir(dst): """Create the path including all parent directories as needed.""" - Trace('mkdir -p ' + dst) + Trace('mkdir -p ' + ShortFilename(dst)) oshelpers.Mkdir(['-p', dst]) def Move(src, dst): """Move the path src to dst.""" - Trace('mv -f %s %s' % (src, dst)) + Trace('mv -f %s %s' % (ShortFilename(src), ShortFilename(dst))) oshelpers.Move(['-f', src, dst]) def RemoveFile(dst): """Remove the provided file.""" - Trace('rm ' + dst) + Trace('rm ' + ShortFilename(dst)) oshelpers.Remove(['-f', dst]) diff --git a/native_client_sdk/src/build_tools/parse_dsc.py b/native_client_sdk/src/build_tools/parse_dsc.py index 18cc722..05e1786 100755 --- a/native_client_sdk/src/build_tools/parse_dsc.py +++ b/native_client_sdk/src/build_tools/parse_dsc.py @@ -11,6 +11,7 @@ import sys VALID_TOOLCHAINS = [ 'bionic', + 'clang-newlib', 'newlib', 'glibc', 'pnacl', diff --git a/native_client_sdk/src/build_tools/sdk_files.list b/native_client_sdk/src/build_tools/sdk_files.list index 04d5f00..ea65895 100644 --- a/native_client_sdk/src/build_tools/sdk_files.list +++ b/native_client_sdk/src/build_tools/sdk_files.list @@ -133,6 +133,38 @@ include/win/sys/poll.h [win]lib/${PLATFORM}_x86_32_host/Release/ppapi_gles2.lib [win]lib/${PLATFORM}_x86_32_host/Release/pthread.lib [win]lib/${PLATFORM}_x86_32_host/Release/sdk_util.lib +lib/clang-newlib_x86_32/Debug/libgmock.a +lib/clang-newlib_x86_32/Debug/libgtest.a +lib/clang-newlib_x86_32/Debug/libnacl_io.a +lib/clang-newlib_x86_32/Debug/libppapi_cpp.a +lib/clang-newlib_x86_32/Debug/libppapi_cpp_private.a +lib/clang-newlib_x86_32/Debug/libppapi_gles2.a +lib/clang-newlib_x86_32/Debug/libppapi_simple.a +lib/clang-newlib_x86_32/Debug/libsdk_util.a +lib/clang-newlib_x86_32/Release/libgmock.a +lib/clang-newlib_x86_32/Release/libgtest.a +lib/clang-newlib_x86_32/Release/libnacl_io.a +lib/clang-newlib_x86_32/Release/libppapi_cpp.a +lib/clang-newlib_x86_32/Release/libppapi_cpp_private.a +lib/clang-newlib_x86_32/Release/libppapi_gles2.a +lib/clang-newlib_x86_32/Release/libppapi_simple.a +lib/clang-newlib_x86_32/Release/libsdk_util.a +lib/clang-newlib_x86_64/Debug/libgmock.a +lib/clang-newlib_x86_64/Debug/libgtest.a +lib/clang-newlib_x86_64/Debug/libnacl_io.a +lib/clang-newlib_x86_64/Debug/libppapi_cpp.a +lib/clang-newlib_x86_64/Debug/libppapi_cpp_private.a +lib/clang-newlib_x86_64/Debug/libppapi_gles2.a +lib/clang-newlib_x86_64/Debug/libppapi_simple.a +lib/clang-newlib_x86_64/Debug/libsdk_util.a +lib/clang-newlib_x86_64/Release/libgmock.a +lib/clang-newlib_x86_64/Release/libgtest.a +lib/clang-newlib_x86_64/Release/libnacl_io.a +lib/clang-newlib_x86_64/Release/libppapi_cpp.a +lib/clang-newlib_x86_64/Release/libppapi_cpp_private.a +lib/clang-newlib_x86_64/Release/libppapi_gles2.a +lib/clang-newlib_x86_64/Release/libppapi_simple.a +lib/clang-newlib_x86_64/Release/libsdk_util.a lib/glibc_x86_32/Debug/libgmock.a lib/glibc_x86_32/Debug/libgmock.so lib/glibc_x86_32/Debug/libgtest.a @@ -362,6 +394,34 @@ toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libnosys.a toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libppapi.a toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libppapi_stub.a toolchain/${PLATFORM}_pnacl/le32-nacl/lib/libpthread.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/irt.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/irt_dev.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/irt_ppapi.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/nacl/dynamic_annotations.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/nacl/nacl_dyncode.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/nacl/nacl_exception.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/nacl/nacl_minidump.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/nacl/nacl_startup.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/pthread.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/include/semaphore.h +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libminidump_generator.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libnacl.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libnacl_dyncode.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libnacl_exception.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libnacl_list_mappings.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libnosys.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libppapi.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libppapi_stub.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib/libpthread.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libminidump_generator.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libnacl.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libnacl_dyncode.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libnacl_exception.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libnacl_list_mappings.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libnosys.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libppapi.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libppapi_stub.a +toolchain/${PLATFORM}_pnacl/x86_64-nacl/lib32/libpthread.a toolchain/${PLATFORM}_x86_glibc/* toolchain/${PLATFORM}_x86_glibc/x86_64-nacl/include/irt.h toolchain/${PLATFORM}_x86_glibc/x86_64-nacl/include/irt_dev.h diff --git a/native_client_sdk/src/build_tools/test_projects.py b/native_client_sdk/src/build_tools/test_projects.py index 40a688c..206bef0 100755 --- a/native_client_sdk/src/build_tools/test_projects.py +++ b/native_client_sdk/src/build_tools/test_projects.py @@ -38,7 +38,15 @@ browser_tester_py = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'tools', ALL_CONFIGS = ['Debug', 'Release'] -ALL_TOOLCHAINS = ['newlib', 'glibc', 'pnacl', 'win', 'linux', 'mac'] +ALL_TOOLCHAINS = [ + 'newlib', + 'glibc', + 'pnacl', + 'win', + 'linux', + 'mac', + 'clang-newlib', +] # Values you can filter by: # name: The name of the test. (e.g. "pi_generator") diff --git a/native_client_sdk/src/build_tools/test_sdk.py b/native_client_sdk/src/build_tools/test_sdk.py index 7f1fe051..4c7d957 100755 --- a/native_client_sdk/src/build_tools/test_sdk.py +++ b/native_client_sdk/src/build_tools/test_sdk.py @@ -132,7 +132,7 @@ def StepRunSelLdrTests(pepperdir, sanitizer): if sanitizer: continue - for toolchain in ('newlib', 'glibc', 'pnacl'): + for toolchain in ('clang-newlib', 'newlib', 'glibc', 'pnacl'): for arch in archs: for config in configs: RunTest(location, toolchain, config, arch) @@ -187,7 +187,7 @@ def main(args): pepper_ver = str(int(build_version.ChromeMajorVersion())) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) - toolchains = ['newlib', 'glibc', 'pnacl'] + toolchains = ['clang-newlib', 'newlib', 'glibc', 'pnacl'] toolchains.append(getos.GetPlatform()) if options.verbose: diff --git a/native_client_sdk/src/examples/demo/life/example.dsc b/native_client_sdk/src/examples/demo/life/example.dsc index 6ffe18c..aedef27 100644 --- a/native_client_sdk/src/examples/demo/life/example.dsc +++ b/native_client_sdk/src/examples/demo/life/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'TARGETS': [ { 'NAME' : 'life', diff --git a/native_client_sdk/src/examples/demo/nacl_io_demo/example.dsc b/native_client_sdk/src/examples/demo/nacl_io_demo/example.dsc index 70b9121..be4288f 100644 --- a/native_client_sdk/src/examples/demo/nacl_io_demo/example.dsc +++ b/native_client_sdk/src/examples/demo/nacl_io_demo/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl', 'bionic', 'linux', 'mac'], + 'TOOLS': ['newlib', 'glibc', 'pnacl', 'bionic', 'linux', 'mac', 'clang-newlib'], 'TARGETS': [ { 'NAME' : 'nacl_io_demo', diff --git a/native_client_sdk/src/examples/demo/pi_generator/example.dsc b/native_client_sdk/src/examples/demo/pi_generator/example.dsc index 1fe7b2e..a1cef4c 100644 --- a/native_client_sdk/src/examples/demo/pi_generator/example.dsc +++ b/native_client_sdk/src/examples/demo/pi_generator/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'TARGETS': [ { 'NAME' : 'pi_generator', diff --git a/native_client_sdk/src/examples/tutorial/testing/example.dsc b/native_client_sdk/src/examples/tutorial/testing/example.dsc index ee0aae5..8a1f551 100644 --- a/native_client_sdk/src/examples/tutorial/testing/example.dsc +++ b/native_client_sdk/src/examples/tutorial/testing/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['glibc', 'newlib', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['glibc', 'newlib', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'SEL_LDR': True, 'TARGETS': [ { diff --git a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc index 5684e87..856ae50 100644 --- a/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc +++ b/native_client_sdk/src/examples/tutorial/using_ppapi_simple/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'SEL_LDR': True, 'TARGETS': [ { diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc index f894e74..dc0f489 100644 --- a/native_client_sdk/src/libraries/nacl_io/library.dsc +++ b/native_client_sdk/src/libraries/nacl_io/library.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'bionic', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['newlib', 'glibc', 'bionic', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'SEARCH': [ '.', 'pepper', diff --git a/native_client_sdk/src/libraries/ppapi_simple/library.dsc b/native_client_sdk/src/libraries/ppapi_simple/library.dsc index fc0f4cb0..ada1bce 100644 --- a/native_client_sdk/src/libraries/ppapi_simple/library.dsc +++ b/native_client_sdk/src/libraries/ppapi_simple/library.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['bionic', 'newlib', 'glibc', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['bionic', 'newlib', 'glibc', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'TARGETS': [ { 'NAME' : 'ppapi_simple', diff --git a/native_client_sdk/src/tests/nacl_io_test/example.dsc b/native_client_sdk/src/tests/nacl_io_test/example.dsc index b063f38..f0a66924 100644 --- a/native_client_sdk/src/tests/nacl_io_test/example.dsc +++ b/native_client_sdk/src/tests/nacl_io_test/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['bionic', 'newlib', 'glibc', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['bionic', 'newlib', 'glibc', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'SEL_LDR': True, 'TARGETS': [ diff --git a/native_client_sdk/src/tests/sdk_util_test/example.dsc b/native_client_sdk/src/tests/sdk_util_test/example.dsc index d1f7ca8..a9c09bb 100644 --- a/native_client_sdk/src/tests/sdk_util_test/example.dsc +++ b/native_client_sdk/src/tests/sdk_util_test/example.dsc @@ -1,5 +1,5 @@ { - 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac'], + 'TOOLS': ['newlib', 'glibc', 'pnacl', 'linux', 'mac', 'clang-newlib'], 'SEL_LDR': True, 'TARGETS': [ diff --git a/native_client_sdk/src/tools/common.mk b/native_client_sdk/src/tools/common.mk index 61717e9..81c60db 100644 --- a/native_client_sdk/src/tools/common.mk +++ b/native_client_sdk/src/tools/common.mk @@ -15,9 +15,9 @@ # accordingly. # ifneq ($(ENABLE_BIONIC),) -ALL_TOOLCHAINS ?= pnacl newlib glibc bionic +ALL_TOOLCHAINS ?= pnacl newlib glibc clang-newlib bionic else -ALL_TOOLCHAINS ?= pnacl newlib glibc +ALL_TOOLCHAINS ?= pnacl newlib glibc clang-newlib endif VALID_TOOLCHAINS ?= $(ALL_TOOLCHAINS) @@ -418,7 +418,7 @@ ifneq (,$(findstring $(TOOLCHAIN),win)) include $(NACL_SDK_ROOT)/tools/host_vc.mk endif -ifneq (,$(findstring $(TOOLCHAIN),glibc newlib bionic)) +ifneq (,$(findstring $(TOOLCHAIN),glibc newlib bionic clang-newlib)) include $(NACL_SDK_ROOT)/tools/nacl_gcc.mk endif diff --git a/native_client_sdk/src/tools/nacl_config.py b/native_client_sdk/src/tools/nacl_config.py index e8a7129..67542b7 100755 --- a/native_client_sdk/src/tools/nacl_config.py +++ b/native_client_sdk/src/tools/nacl_config.py @@ -44,7 +44,7 @@ ARCH_BASE_NAME = { 'x86_64': 'x86' } -NACL_TOOLCHAINS = ('newlib', 'glibc', 'pnacl', 'bionic') +NACL_TOOLCHAINS = ('newlib', 'glibc', 'pnacl', 'bionic', 'clang-newlib') HOST_TOOLCHAINS = ('linux', 'mac', 'win') VALID_TOOLCHAINS = list(HOST_TOOLCHAINS) + list(NACL_TOOLCHAINS) + ['host'] @@ -57,7 +57,7 @@ VALID_TOOLCHAINS = list(HOST_TOOLCHAINS) + list(NACL_TOOLCHAINS) + ['host'] # Most tools will be passed through directly. # e.g. For PNaCl foo => pnacl-foo # For NaCl foo => x86_64-nacl-foo. -PNACL_TOOLS = { +CLANG_TOOLS = { 'cc': 'clang', 'c++': 'clang++', 'gcc': 'clang', @@ -65,7 +65,7 @@ PNACL_TOOLS = { 'ld': 'clang++' } -NACL_TOOLS = { +GCC_TOOLS = { 'cc': 'gcc', 'c++': 'g++', 'gcc': 'gcc', @@ -153,7 +153,7 @@ def GetToolchainDir(toolchain, arch=None): ExpectToolchain(toolchain, NACL_TOOLCHAINS) root = GetPosixSDKPath() platform = getos.GetPlatform() - if toolchain == 'pnacl': + if toolchain in ('pnacl', 'clang-newlib'): subdir = '%s_pnacl' % platform else: assert arch is not None @@ -178,6 +178,8 @@ def GetToolchainBinDir(toolchain, arch=None): def GetSDKIncludeDirs(toolchain): root = GetPosixSDKPath() base_include = posixpath.join(root, 'include') + if toolchain == 'clang-newlib': + toolchain = 'newlib' return [base_include, posixpath.join(base_include, toolchain)] @@ -197,12 +199,15 @@ def GetToolPath(toolchain, arch, tool): if toolchain == 'pnacl': CheckValidToolchainArch(toolchain, arch) - tool = PNACL_TOOLS.get(tool, tool) + tool = CLANG_TOOLS.get(tool, tool) full_tool_name = 'pnacl-%s' % tool else: CheckValidToolchainArch(toolchain, arch, arch_required=True) ExpectArch(arch, VALID_ARCHES) - tool = NACL_TOOLS.get(tool, tool) + if toolchain == 'clang-newlib': + tool = CLANG_TOOLS.get(tool, tool) + else: + tool = GCC_TOOLS.get(tool, tool) full_tool_name = '%s-nacl-%s' % (GetArchName(arch), tool) return posixpath.join(GetToolchainBinDir(toolchain, arch), full_tool_name) diff --git a/native_client_sdk/src/tools/nacl_gcc.mk b/native_client_sdk/src/tools/nacl_gcc.mk index 1b0d984..37fb448 100644 --- a/native_client_sdk/src/tools/nacl_gcc.mk +++ b/native_client_sdk/src/tools/nacl_gcc.mk @@ -26,7 +26,11 @@ X86_64_STRIP := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=strip) X86_64_NM := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a x86_64 --tool=nm) endif -ifeq (,$(findstring $(TOOLCHAIN),glibc)) +ifneq (,$(findstring $(TOOLCHAIN),newlib bionic)) +ARM_SUPPORT=1 +endif + +ifeq ($(ARM_SUPPORT),1) ARM_CC := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=cc) ARM_CXX := $(NACL_COMPILER_PREFIX) $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=c++) ARM_LINK := $(shell $(NACL_CONFIG) -t $(TOOLCHAIN) -a arm --tool=c++) @@ -179,7 +183,7 @@ endef ifneq ($(TOOLCHAIN),bionic) VALID_ARCHES := x86_32 x86_64 endif -ifneq (glibc,$(TOOLCHAIN)) +ifeq ($(ARM_SUPPORT),1) VALID_ARCHES += arm endif @@ -319,7 +323,7 @@ $(LIBDIR)/$(TOOLCHAIN)_x86_64/$(CONFIG)/lib$(1).a: $(X86_64_OUTDIR)/lib$(1)_x86_ endif ifneq (,$(findstring arm,$(ARCHES))) -ifneq ($(TOOLCHAIN),glibc) +ifeq ($(ARM_SUPPORT),1) all: $(ARM_OUTDIR)/lib$(1)_arm.a $(ARM_OUTDIR)/lib$(1)_arm.a: $(foreach src,$(2),$(call SRC_TO_OBJ,$(src),_arm)) $(MKDIR) -p $$(dir $$@) |