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

Side by Side Diff: toolchain_build/pnacl_targetlibs.py

Issue 1412503002: PNaCl. Enables Unsandboxed nonsfi ARM32. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: Created 5 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2013 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 """Recipes for PNaCl target libs.""" 6 """Recipes for PNaCl target libs."""
7 7
8 import fnmatch 8 import fnmatch
9 import os 9 import os
10 import sys 10 import sys
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 '--disable-libgloss', 466 '--disable-libgloss',
467 '--enable-newlib-iconv', 467 '--enable-newlib-iconv',
468 '--enable-newlib-iconv-from-encodings=' + 468 '--enable-newlib-iconv-from-encodings=' +
469 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4', 469 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4',
470 '--enable-newlib-iconv-to-encodings=' + 470 '--enable-newlib-iconv-to-encodings=' +
471 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4', 471 'UTF-8,UTF-16LE,UCS-4LE,UTF-16,UCS-4',
472 '--enable-newlib-io-long-long', 472 '--enable-newlib-io-long-long',
473 '--enable-newlib-io-long-double', 473 '--enable-newlib-io-long-double',
474 '--enable-newlib-io-c99-formats', 474 '--enable-newlib-io-c99-formats',
475 '--enable-newlib-mb', 475 '--enable-newlib-mb',
476 '--enable-newlib-multithread',
476 '--target=' + newlib_triple 477 '--target=' + newlib_triple
477 ]), 478 ]),
478 command.Command(MakeCommand()), 479 command.Command(MakeCommand()),
479 command.Command(['make', 'DESTDIR=%(abs_output)s', 'install']), 480 command.Command(['make', 'DESTDIR=%(abs_output)s', 'install']),
480 ] + NewlibDirectoryCmds(bias_arch, newlib_triple) 481 ] + NewlibDirectoryCmds(bias_arch, newlib_triple)
481 }, 482 },
482 T('libcxx'): { 483 T('libcxx'): {
483 'type': TargetLibBuildType(is_canonical), 484 'type': TargetLibBuildType(is_canonical),
484 'dependencies': ['libcxx_src', 'libcxxabi_src', 'llvm_src', 'gcc_src', 485 'dependencies': ['libcxx_src', 'libcxxabi_src', 'llvm_src', 'gcc_src',
485 'target_lib_compiler', T('newlib'), 486 'target_lib_compiler', T('newlib'),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 624
624 When the commands are executed, temporary files are created in the current 625 When the commands are executed, temporary files are created in the current
625 directory, and .o files are created in the out_dir directory. If arch isn't 626 directory, and .o files are created in the out_dir directory. If arch isn't
626 among a whitelist, an empty list of commands is returned. 627 among a whitelist, an empty list of commands is returned.
627 """ 628 """
628 # LlcArchArgs contains arguments extracted from pnacl-translate.py. 629 # LlcArchArgs contains arguments extracted from pnacl-translate.py.
629 if arch == 'x86-32-linux': 630 if arch == 'x86-32-linux':
630 LlcArchArgs = [ '-mtriple=i686-linux-gnu', '-mcpu=pentium4m'] 631 LlcArchArgs = [ '-mtriple=i686-linux-gnu', '-mcpu=pentium4m']
631 elif arch == 'x86-32': 632 elif arch == 'x86-32':
632 LlcArchArgs = [ '-mtriple=i686-none-nacl-gnu', '-mcpu=pentium4m'] 633 LlcArchArgs = [ '-mtriple=i686-none-nacl-gnu', '-mcpu=pentium4m']
634 if arch == 'arm-linux':
635 LlcArchArgs = [ '-mtriple=arm-linux-gnu', '-mcpu=cortex-a9']
636 elif arch == 'arm':
637 LlcArchArgs = [ '-mtriple=arm-none-nacl-gnu', '-mcpu=cortex-a9']
633 else: 638 else:
634 return [] 639 return []
635 return [ 640 return [
636 command.Command([ 641 command.Command([
637 PnaclTool('clang'), '-O2', 642 PnaclTool('clang'), '-O2',
638 '-c', command.path.join('%(subzero_src)s', 'runtime', 'szrt.c'), 643 '-c', command.path.join('%(subzero_src)s', 'runtime', 'szrt.c'),
639 '-o', 'szrt.tmp.bc']), 644 '-o', 'szrt.tmp.bc']),
640 command.Command([ 645 command.Command([
641 PnaclTool('opt'), '-pnacl-abi-simplify-preopt', 646 PnaclTool('opt'), '-pnacl-abi-simplify-preopt',
642 '-pnacl-abi-simplify-postopt', '-pnaclabi-allow-debug-metadata', 647 '-pnacl-abi-simplify-postopt', '-pnaclabi-allow-debug-metadata',
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 'unwind-dw2-fde-glibc.o', arch, no_nacl_gcc), 811 'unwind-dw2-fde-glibc.o', arch, no_nacl_gcc),
807 command.Command([PnaclTool('ar'), 'rc', 812 command.Command([PnaclTool('ar'), 'rc',
808 command.path.join('%(output)s', 'libgcc_eh.a'), 813 command.path.join('%(output)s', 'libgcc_eh.a'),
809 'unwind-dw2.o', 'unwind-dw2-fde-glibc.o']), 814 'unwind-dw2.o', 'unwind-dw2-fde-glibc.o']),
810 ], 815 ],
811 }, 816 },
812 }) 817 })
813 return libs 818 return libs
814 819
815 def UnsandboxedRuntime(arch, is_canonical): 820 def UnsandboxedRuntime(arch, is_canonical):
821 prefix = {
822 'arm-linux': 'arm-linux-gnueabihf-',
823 'x86-32-linux': '',
824 }[arch]
825 arch_cflags = {
826 'arm-linux': ['-mcpu=cortex-a9', '-D__arm_nonsfi_linux__'],
827 'x86-32-linux': ['-m32'],
828 }[arch]
829
816 libs = { 830 libs = {
817 GSDJoin('unsandboxed_runtime', arch): { 831 GSDJoin('unsandboxed_runtime', arch): {
818 'type': TargetLibBuildType(is_canonical), 832 'type': TargetLibBuildType(is_canonical),
819 'output_subdir': os.path.join('translator', arch, 'lib'), 833 'output_subdir': os.path.join('translator', arch, 'lib'),
820 'dependencies': [ 'subzero_src', 'target_lib_compiler'], 834 'dependencies': [ 'subzero_src', 'target_lib_compiler'],
821 # This lib #includes 835 # This lib #includes
822 # arbitrary stuff from native_client/src/{include,untrusted,trusted} 836 # arbitrary stuff from native_client/src/{include,untrusted,trusted}
823 'inputs': { 'support': os.path.join(NACL_DIR, 'src', 'nonsfi', 'irt'), 837 'inputs': { 'support': os.path.join(NACL_DIR, 'src', 'nonsfi', 'irt'),
824 'untrusted': os.path.join( 838 'untrusted': os.path.join(
825 NACL_DIR, 'src', 'untrusted', 'irt'), 839 NACL_DIR, 'src', 'untrusted', 'irt'),
826 'include': os.path.join(NACL_DIR, 'src'), }, 840 'include': os.path.join(NACL_DIR, 'src'), },
827 'commands': [ 841 'commands': [
828 # The NaCl headers insist on having a platform macro such as 842 # The NaCl headers insist on having a platform macro such as
829 # NACL_LINUX defined, but src/nonsfi/irt_interfaces.c does not 843 # NACL_LINUX defined, but src/nonsfi/irt_interfaces.c does not
830 # itself use any of these macros, so defining NACL_LINUX here 844 # itself use any of these macros, so defining NACL_LINUX here
831 # even on non-Linux systems is OK. 845 # even on non-Linux systems is OK.
832 # TODO(dschuff): this include path breaks the input encapsulation 846 # TODO(dschuff): this include path breaks the input encapsulation
833 # for build rules. 847 # for build rules.
834 command.Command([ 848 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall',
835 'gcc', '-m32', '-O2', '-Wall', '-Werror', 849 '-Werror', '-I%(top_srcdir)s/..',
836 '-I%(top_srcdir)s/..', '-DNACL_LINUX=1', '-DDEFINE_MAIN', 850 '-DNACL_LINUX=1', '-DDEFINE_MAIN',
837 '-c', command.path.join('%(support)s', 'irt_interfaces.c'), 851 '-c', command.path.join('%(support)s', 'irt_interfaces.c'),
838 '-o', command.path.join('%(output)s', 'unsandboxed_irt.o')]), 852 '-o', command.path.join('%(output)s', 'unsandboxed_irt.o')]),
839 command.Command([ 853 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall',
840 'gcc', '-m32', '-O2', '-Wall', '-Werror', 854 '-Werror', '-I%(top_srcdir)s/..',
841 '-I%(top_srcdir)s/..',
842 '-c', command.path.join('%(support)s', 'irt_random.c'), 855 '-c', command.path.join('%(support)s', 'irt_random.c'),
843 '-o', command.path.join('%(output)s', 'irt_random.o')]), 856 '-o', command.path.join('%(output)s', 'irt_random.o')]),
844 command.Command([ 857 command.Command([prefix + 'gcc'] + arch_cflags + ['-O2', '-Wall',
845 'gcc', '-m32', '-O2', '-Wall', '-Werror', 858 '-Werror', '-I%(top_srcdir)s/..',
846 '-I%(top_srcdir)s/..',
847 '-c', command.path.join('%(untrusted)s', 'irt_query_list.c'), 859 '-c', command.path.join('%(untrusted)s', 'irt_query_list.c'),
848 '-o', command.path.join('%(output)s', 'irt_query_list.o')]), 860 '-o', command.path.join('%(output)s', 'irt_query_list.o')]),
849 ] + SubzeroRuntimeCommands(arch, '%(output)s'), 861 ] + SubzeroRuntimeCommands(arch, '%(output)s'),
850 }, 862 },
851 } 863 }
852 return libs 864 return libs
853 865
854 866
855 def SDKCompiler(arches): 867 def SDKCompiler(arches):
856 arch_packages = ([GSDJoin('newlib', arch) for arch in arches] + 868 arch_packages = ([GSDJoin('newlib', arch) for arch in arches] +
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 'includedir=' +os.path.join('%(output)s', 907 'includedir=' +os.path.join('%(output)s',
896 TripleFromArch(MultilibArch(arch)), 908 TripleFromArch(MultilibArch(arch)),
897 'include'), 909 'include'),
898 'libdir=' + os.path.join('%(output)s', MultilibLibDir(arch)), 910 'libdir=' + os.path.join('%(output)s', MultilibLibDir(arch)),
899 'install'] + scons_flags, 911 'install'] + scons_flags,
900 cwd=NACL_DIR), 912 cwd=NACL_DIR),
901 ], 913 ],
902 } 914 }
903 } 915 }
904 return libs 916 return libs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698